Skip to content

System.Threading.Thread.StartCallback() - System.NullReferenceException #109697

Description

@tub5

Runtime: 8.0.10
OS: Ubuntu Server 22.04

We've had multiple Fatal exceptions in our production server causing docker containers to fail due to a System.NullReferenceException in System.Threading.Thread.StartCallback(). Looking at the line in question /_/src/coreclr/System.Private.CoreLib/src/System/Threading/Thread.CoreCLR.cs @ 103 I can see the code is as follows:

// Called from the runtime
private void StartCallback()
{
    StartHelper? startHelper = _startHelper;
    Debug.Assert(startHelper != null);
    _startHelper = null;

    startHelper.Run();
}

If startHelper is nullable, should the final line be startHelper?.Run(); to prevent the null reference exception?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Threadingtracking-external-issueThe issue is caused by external problem (e.g. OS) - nothing we can do to fix it directly

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions