0
$\begingroup$

This question is additional question to Maintaining SQLConnections In Mathematica 10.4.1.0 (64bit).

<< DatabaseLink`DatabaseExamples`
DatabaseExamplesBuild[]
Needs["DatabaseLink`"]
Needs["JLink`"]
maintainConnection // Attributes = {HoldFirst};
maintainConnection := conn = OpenSQLConnection["demo"];
t2 := maintainConnection;
t1 := RunScheduledTask[t2; RemoveScheduledTask[$ScheduledTask], {1}]
t1

after executing t1 every expression is executed fully, so t1,t2,maintainConnection and $ScheduledTask is removed after it finishes, but kernel stays hanging, and only way is to Quit kernel. The way to avoid this is to assign conn = OpenSQLConnection["demo"] prior the calling ScheduledTask, so prior executing t1, and after this subsequently call t2 via Scheduling as needed. This is most simple example, that, as exposed seem does not have sense, but in complicated where one scheduled task is initiated in another, it does, and in that situation conn = OpenSQLConnection["demo"] should be avoided, as a call outside of t1, or another ScheduledTask. In Mathematica 11.3 this does not cause kernel hangs.

Is this is a bug, or I'm doing something on wrong way?

$\endgroup$
  • $\begingroup$ Please do not use the bugs tag until your observations have been confirmed to be a bug. $\endgroup$ – J. M. will be back soon Mar 31 '18 at 19:16
  • $\begingroup$ I recommend to use "AutoRemove" -> True instead of removing the task using RemoveScheduledTask inside RunScheduledTask. $\endgroup$ – Ariel Sepulveda Apr 24 '18 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.