SQLConnection causes kernel hangs


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

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

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?


Posted 2018-03-31T19:06:41.350

Reputation: 870

Please do not use the [tag:bugs] tag until your observations have been confirmed to be a bug. – J. M.'s ennui – 2018-03-31T19:16:17.090

I recommend to use "AutoRemove" -> True instead of removing the task using RemoveScheduledTask inside RunScheduledTask. – Ariel Sepulveda – 2018-04-24T14:46:03.020

No answers