Skip to content

Possible deadlock on process exit if GC is in progress #107800

Closed
@VSadov

Description

Bug reported by internal partners. In some relatively infrequent cases a worker process may get stuck at exiting.
Such "stuck" processes could become a nuisance, especially when the memory footprint is large.

The reason for the lock up is that an exiting thread tries to get into COOP mode to fix up its stack.
This should only be done when a thread exits cleanly (i.e. thread exits). When this is a result of process termination (i.e. thread calls ExitProcess), getting into COOP mode can wait for GC state to clear, which may never happen, since we may not have GC any more.

The bug seems to be old - I tried 9.0, 8.0, 6.0 and saw it reproducing with a small directed repro.

The bug does not affect NativeAOT, only CoreCLR.

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions