Here is an example:
x = 0; Dynamic[x]
now please run:
SessionSubmit[x = 1; Pause;]
Dynamic[x]is not updated before
Serious one: if
Pauseor whatever that follows
x=1is longer than
DynamicEvaluationTimeout(6sec) then the FrontEnd will become unresponsive.
This means that by doing a very standard thing and not requiring any fancy result you will get your FE stuck just because you modified a tracked variable within a scheduled task.
It looks like scheduled evaluations are or behave as wrapped with
One can see via LinkSnooper that soon after
x=1 the Kernel tells the FrontEnd to update dynamic object. FrontEnd, using preemptive link, asks for the content of
Dynamic[x] but the response is delayed till pause is finished. That delay is what causes problems.
One should note that in case
x=1;Pause evaluated as a normal code line it does not happen because preemptive link calculations can interrupt main link calculations. There is no documentation about what should happen when the long calculation is initiated from a scheduled task as opposed to a main link request.
is that behavior expected? (not being able to interrupt a scheduled task)
is there a workaround? For simple cases one could do
SessionSubmit[x = 1; SessionSubmit@Pause;]but that does not scale at all.
at the end I could live with waiting till whole task is finished but I can not accept that the FrontEnd stalls. To prevent it I'd need to make
x=1not to trigger updating at all till the scheduled evaluation is finished. That way FE won't ask back to early and won't get stuck.
UpdateDynamicObjectstill it is safe. E.g.
RunScheduledTask[QueueTracking[procedure], ...]where when
QueueTrackingfinished all collected ids are sent. $\endgroup$