Skip to content

Capture every GameThread exception in native_crash.log to identify the real DrawThread killer - #239

Merged
winnerspiros merged 1 commit into
masterfrom
copilot/fix-apk-crash-issue-yet-again
Apr 22, 2026
Merged

Capture every GameThread exception in native_crash.log to identify the real DrawThread killer#239
winnerspiros merged 1 commit into
masterfrom
copilot/fix-apk-crash-issue-yet-again

Conversation

Copilot AI commented Apr 22, 2026

Copy link
Copy Markdown

The latest tombstone shows the DrawThread dying ~5s into startup with signal 11 SIGSEGV, code -6 (SI_TKILL), pc=0x0 and lr inside a JIT mapping — the Mono-re-raises-a-managed-exception-via-tgkill pattern. UTF-16 fragments left in stack scratch memory ("…argeting a Texture with format ", "A TextureView's format must ") match Veldrid's ResourceFactory.CreateTextureView validation throw, but native_crash.log contains no managed block for it — the FirstChanceException filter in CrashDiagnostics only logs a fixed set of fatal-ish types (NRE/AVE/TypeInit/DllNotFound/…), and VeldridException is not on the list, so the actual culprit was silently dropped.

Without the managed stack we cannot know which CreateTextureView call passes the mismatched format, and patching the renderer from heap residue would be guesswork. This change widens diagnostics so the next crash log pinpoints the call site.

Changes

  • osu.Android/CrashDiagnostics.cs — split FirstChanceException filtering by thread:
    • GameThreads (Thread.Name starts with Draw / Update / Audio / Input, or contains GameThread): log every exception with full stack. These are the threads whose unhandled throws on Android tear the process down via Mono's tgkill(SIGSEGV) path without ever reaching AppDomain.UnhandledException.
    • All other threads: keep the existing fatal-types filter unchanged so the log isn't flooded by routine first-chance noise (e.g. the recurring HidSharp / `C

@winnerspiros
winnerspiros marked this pull request as ready for review April 22, 2026 13:38
Copilot AI review requested due to automatic review settings April 22, 2026 13:38
@winnerspiros
winnerspiros merged commit 4d73c09 into master Apr 22, 2026
4 of 14 checks passed
@gitar-bot

gitar-bot Bot commented Apr 22, 2026

Copy link
Copy Markdown

Important

You are using the Gitar free plan. Upgrade to unlock code review, CI analysis, auto-apply, custom automations, and more.

Gitar

Copilot AI left a comment

Copy link
Copy Markdown

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 expands Android crash diagnostics to ensure the actual exception killing the process (especially on osu.Framework GameThreads where Mono may abort via tgkill(SIGSEGV) without reaching AppDomain.UnhandledException) is captured into native_crash.log.

Changes:

  • Adjust FirstChanceException logging policy to log all exceptions on GameThreads (Draw/Update/Audio/Input/GameThread) while keeping the existing “fatal-ish exception types” filter for other threads.
  • Add a helper to identify osu.Framework GameThreads by stable thread-name patterns.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +231 to 234
if (isGameThread || isFatalKind)
{
writeManagedException($"FirstChanceException ({e.Exception.GetType().Name})", e.Exception);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants