Closed bcleech closed 2 months ago
@jonsequitur , thank you for fixing this. I noticed you no longer pass the CancellationToken
to Task.Factory.StartNew
. Is this intentional? Would this be better as:
_runLoopTask = Task.Factory.StartNew(
ScheduledOperationRunLoop,
_schedulerDisposalSource.Token,
TaskCreationOptions.LongRunning,
TaskScheduler.Current);
Describe the bug
While debugging a thread pool starvation issue, I noticed that
KernelScheduler.ScheduledOperationRunLoop
is executing on a thread pool thread, but spends most of its time blocked (ultimately inMonitor.Wait
).Stack trace when idle:
It looks like it was intended to be started with
TaskCreationOptions.LongRunning
, but the call toTask.Factory.StartNew
in theKernelScheduler
constructor is incorrect:This actually calls this overload of
Task.Factory.StartNew
:Which means
TaskCreationOptions.LongRunning
is passed as the state parameter and is passed as an argument toScheduledOperationRunLoop
(where it is ignored). It should be passed as the creationOptions parameter in one of the other overloads.Please complete the following:
Which version of .NET Interactive are you using? (In a notebook, run the
#!about
magic command. ):1.0.0-beta.22552.6. Not the latest, but issue is still present in latest source code.
Screenshots
If applicable, add screenshots to help explain your problem.