Skip to content

Conversation

@lateralusX
Copy link
Member

As part of d34ef7e a number of additional stack walking scenarios that could run as async signal safe (called from signal handlers), was flag as being async signal safe, prevents loading of full MonoJitInfo for AOT methods due to risk of deadlocks under async signal safe mode.

An AOT methods MonoJitInfo loaded when a thread runs in async signal safe mode can't be passed to mono_jit_info_get_method or it will trigger the following assert:

Assertion jit-info.c:918 (!ji->async)

There are some issues reporting this assert for .net10, like:

#122797

After looking over the changes done in d34ef7e it appears that two scenarios, get_thread_dump and mono_handle_native_crash could hit scenarios where it would call mono_jit_info_get_method using MonoJitInfo loaded under async signal safe mode.

This PR fixes both these scenarios making sure they correctly check the async state of MonoJitInfo before calling mono_jit_info_get_method.

For more details, #122797 (comment).

…sync signal safe mode.

As part of dotnet@d34ef7e a number of additional stack walking scenarios that could run as async signal safe (called from signal handlers), was flag as being async, preventing loading of full MonoJitInfo.

An AOT methods MonoJitInfo loaded when a thread runs in async signal safe mode can't be passed to mono_jit_info_get_method or it will trigger the following assert:

Assertion jit-info.c:918 (!ji->async)

There are some issues reporting this assert for .net10, like:

dotnet#122797

After looking over the changes done in dotnet@d34ef7e it appears that two scenarios, get_thread_dump and mono_handle_native_crash could hit scenarios where it would call mono_jit_info_get_method using MonoJitInfo loaded under async signal safe mode.

This PR fixes both these scenarios making sure they correctly check the async state of MonoJitInfo before calling mono_jit_info_get_method.

For more details, dotnet#122797 (comment).
@lateralusX lateralusX requested a review from BrzVlad as a code owner January 19, 2026 12:19
Copilot AI review requested due to automatic review settings January 19, 2026 12:19
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jan 19, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a crash in Mono's stack walking functionality when running in async signal safe mode. The issue occurs when mono_jit_info_get_method is called on a MonoJitInfo structure that was loaded during async signal safe operations (indicated by the async flag), which triggers an assertion failure.

Changes:

  • Added !ji->async checks before calling jinfo_get_method in two locations in mini-exceptions.c
  • Added frame->ji && !frame->ji->async check before calling mono_jit_info_get_method in threads.c

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/mono/mono/mini/mini-exceptions.c Added async flag checks in mono_find_jit_info (line 601) and print_stack_frame_signal_safe (line 2912) to prevent calling jinfo_get_method on async-loaded JIT info
src/mono/mono/metadata/threads.c Added async flag check in dump_thread (line 3046) to prevent calling mono_jit_info_get_method on async-loaded JIT info during thread dump collection

@lateralusX
Copy link
Member Author

WASM build issues are known issue, #123237.

@BrzVlad
Copy link
Member

BrzVlad commented Jan 20, 2026

I initially assumed the assertion was happening during normal operation of the app. It would be great if this actually happened only when the app was already closing. This would need backport to .net10

Copy link
Member

@BrzVlad BrzVlad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lateralusX lateralusX merged commit f49873c into dotnet:main Jan 30, 2026
74 of 78 checks passed
@lateralusX
Copy link
Member Author

/backport to release/10.0

@github-actions
Copy link
Contributor

Started backporting to release/10.0 (link to workflow run)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants