Skip to content

3.0 preview 2: NullReferenceException at CancellationTokenSource.CallbackPartition.Unregister #12157

@tactical-drone

Description

@tactical-drone

On linux with the new preview I have stumbled upon some kind of strange rare bug that does not occur on Windows. The result is a clr crash with sigsegv.

When I run the program overnight with gdb --args dotnet run ... it ran for 7 hours then crashed with:

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Threading.CancellationTokenSource.CallbackPartition.Unregister(Int64 id, CallbackNode node)
   at System.Threading.Tasks.Task.DelayPromiseWithCancellation.Cleanup()
   at System.Threading.Tasks.Task.DelayPromise.CompleteTimedOut()
   at System.Threading.Tasks.Task.DelayPromise.<>c.<.ctor>b__1_0(Object state)
   at System.Threading.TimerQueueTimer.CallCallback(Boolean isThreadPool)
   at System.Threading.TimerQueueTimer.Fire(Boolean isThreadPool)
   at System.Threading.TimerQueue.FireNextTimers()
[New Thread 0x7fffff580700 (LWP 4018)]
[New Thread 0x7ffff6fb0700 (LWP 4019)]
[Thread 0x7ffffcea0700 (LWP 815) exited]
[Thread 0x7ffffc690700 (LWP 816) exited]
[Thread 0x7ffffbe80700 (LWP 817) exited]
[Thread 0x7ffffb2f0700 (LWP 818) exited]
[Thread 0x7fffff5f0700 (LWP 819) exited]
[Thread 0x7ffff6580700 (LWP 824) exited]
[Thread 0x7fff83900700 (LWP 827) exited]
[Thread 0x7fff825b0700 (LWP 845) exited]
[Thread 0x7fffff4a0700 (LWP 927) exited]
[Thread 0x7ffff77c0700 (LWP 4015) exited]
[Thread 0x7fffff580700 (LWP 4018) exited]
[Thread 0x7ffff6fb0700 (LWP 4019) exited]
[Inferior 1 (process 814) exited with code 0206]
(gdb)

I have no idea why the output looks like that and why a C# like stacktrace was printed. I was expecting some machine code or something.

This did not occur on dotnet 3 preview 1. I am highly confident the issue was introduced with preview 2. But there still might be a small chance my program is causing this somehow since I interop with C code. Even though that C code does not use pointers at all.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions