feat: _ANR detector and Sentry reporting Minidump files - #8811
Conversation
…feat/anr-detection
…nd-macos-only-flags # Conflicts: # .github/workflows/build-unitycloud.yml
|
PR #8811, run #26238775740 Builds: Windows change, Windows baseline, macOS change, macOS baseline Framework 13 i7
|
…plorer into feat/anr-detection
Claude PR Review — security re-review after
|
Claude PR Review — security re-review after
|
This comment has been minimized.
This comment has been minimized.
|
PR #8811, run #26248729154 Builds: Windows change, Windows baseline, macOS change, macOS baseline Framework 13 i7
|
|
Build: Passed: ✅
Everything I can validate from the client side looks good on both platforms. Sentry was verified here Windows with dump MacOS without dump Logs: |
This comment has been minimized.
This comment has been minimized.
|
PR #8811, run #26754316705 Builds: Windows change, Windows baseline, macOS change, macOS baseline Framework 13 i7
|
Ludmilafantaniella
left a comment
There was a problem hiding this comment.
QA Re-test Pass ✅
Build: v0.149.0-alpha-feat/anr-detection-hotfix — Windows 11 + macOS (Apple M3 Pro)
Sentry verified:
DclApplicationNotRespondingExceptionevents arriving correctly inunity-test-environment✅- 12 attachments present (minidump ZIP) ✅
- Environment tag showing
development— no more<REPLACE_ENVIRONMENT>placeholder ✅ - Legacy
Sentry.Unity.Integrations.ApplicationNotRespondingExceptionnot firing — no duplicates ✅
Client-side (both platforms):
- Normal operation, no false-positive ANR events ✅
/anr-simulatefreezes main thread, app recovers normally ✅- Sentry status section present in startup logs ✅
Good to merge 🚀
8811-evi2.mp4
8811-evi1.mp4
✅Smoke test performed:
- ✔️ Log In/Log Out
- ✔️ Backpack and wearables in world
- ✔️ Emotes in world and in backpack
- ✔️ Teleport with map/coordinates/Jump In
- ✔️ Chat and multiplayer
- ✔️ Profile card
- ✔️ Camera
- ✔️ Skybox
This comment has been minimized.
This comment has been minimized.
|
Claude finished @NickKhalow's task in 1m 36s —— View job Claude PR Review — re-review after
|
| Concern | Status |
|---|---|
| External dependencies / native binaries | No change since previous review |
| Workflow / prompt files | git diff origin/dev...HEAD -- '.github/' only contains pre-existing changes already reviewed |
| Asmdef visibility / asmref changes | None new |
Carry-over nits — re-checked, still standing
The address chat command commit didn't touch any of these:
-
Explorer/Assets/DCL/Chat/Commands/AnrDumpChatCommand.cs:2,6—using Cysharp.Threading.Tasks;is still duplicated. Fix this → -
Explorer/Assets/DCL/Chat/Commands/AnrSimulateChatCommand.cs:15-26—ValidateParameters(line 15) only checks parseability; on line 23 theint.TryParsereturn is ignored. The new WebGL guard mitigates WebGL behavior but does not address the input validation issue:/anr-simulate -1still freezes for negative values on desktop (someThread.Sleepoverloads throwArgumentOutOfRangeException), and/anr-simulate 2147483647is still a ~25-day freeze. Clamp to e.g.[0, 60000]ms and reject invalid input inValidateParameters. Fix this → -
Explorer/Assets/DCL/PerformanceAndDiagnostics/Diagnostics/ReportsHandling/Sentry/DclAnrIntegration.cs:58-73—Watchdog.OnApplicationNotResponding +=is still outside theif (Watchdog is null)guard. IfRegisterruns twice (editor reload, or two integrations registered) the same ANR is reported once perRegistercall. Move the subscription inside theif (Watchdog is null)block. Fix this → -
macOS
libDCLProcesses.dylibdrift /dcl_start_process_blockingdead code — unchanged;ExecuteBlockingstill has zero C# callers in this PR. Either rebuild the dylib or remove the export fromdcl_processes.{c,h}andDclProcessesNativeMethods.csif it's not going to be used. -
DclAnrIntegration.cs(NewDumpAttachment) — on dump failure the original.dmpis not cleaned up; the only cleanup happens inCollectDumpInfoBase64. ANR-path attachments live inApplication.persistentDataPathand may accumulate for users that experience repeated ANRs. -
WebGL fallback still dead code —
#if !UNITY_WEBGLat the top ofDclAnrIntegration.csexcludes the whole file from WebGL builds, soDclAnrWatchDogSingleThreaded(and the inner#elsebranch at lines 50-54) are never compiled. The "WebGL fallback (coroutine-based)" wording in the PR description no longer matches behavior. Either drop the dead class & branch, or move the file-level guard to only wrap the parts that truly need it.
Verdict
The single commit since the previous review is a one-line WebGL safety guard for the debug /anr-simulate command. No new dependency / workflow / binary risk surface. The non-blocking nits from the previous review are unchanged.
DEPENDENCY_REVIEW: PASS
· branch feat/anr-detection

Pull Request Description
What does this PR change?
Features
MiniDumpWriteDumpAPI/anr-simulate [ms]— Freeze the main thread to trigger ANR detection (default 10s)/anr-dump— Manually collect and archive a process dump (Windows only)Key components
DclAnrIntegration— SentryISdkIntegrationthat creates and registers the watchdogDclAnrWatchDog(abstract) — Base watchdog with pause/resume awareness, configurable timeout, and minidump collection on reportDclAnrWatchDogMultiThreaded— Desktop implementation: a background thread monitors main-thread heartbeats via a coroutine tick counterDclAnrWatchDogSingleThreaded— WebGL fallback: coroutine-based elapsed-time check (single-threaded environment)DclApplicationNotRespondingException— Custom exception type with Sentry mechanism metadata; on Windows, carries the dump file path for attachmentThreadsDumpUtility— Windows-only utility that:MiniDumpWriteDumpWin32 API (viaMiniDumpNative) to generate a.dmpfile — no external binaries requiredPROCESS_QUERY_INFORMATION | PROCESS_VM_READviaProcessInfoNative, with properIDisposablehandle cleanupApplication.persistentDataPathandApplication.streamingAssetsPathon the main thread ([RuntimeInitializeOnLoadMethod]) since Unity APIs are unavailable from background threadsTools/ProcDump/Dump Current) for quick testing during developmentMiniDumpNative— Static class wrapping theDbghelp.dllMiniDumpWriteDumpP/Invoke with thread-info, handle-data, and unloaded-modules dump flagsProcessInfoNative/ProcessHandle— Win32 process handle management withIDisposablefor safe cleanupDclProcesses.ExecuteBlocking/dcl_start_process_blocking— New native C function for blocking process execution (waits for child exit and returns exit code), available on both Windows (_spawnvp _P_WAIT) and macOS (posix_spawnp+waitpid)Debug chat commands (registered in
DynamicWorldContainer)/anr-simulate [ms]— Freezes the main thread for the specified duration (default 10s) to trigger ANR detection/anr-dump— Manually collects and archives a process dump to the app directory (Windows only); runs on a background thread viaExecuteOnThreadPoolScopeSentry diagnostics & CI
DiagnosticInfoUtilsnow logs whether Sentry is enabled, plus its environment, release, and DSN status at startupenable-sentryPR label — Thebuild-unitycloud.ymlworkflow now checks for anenable-sentrylabel on PR builds, allowing Sentry to be activated for specific PRs without requiring a manual workflow inputscript-debuggingPR label /script_debuggingworkflow input — EnablesAllowDebuggingbuild option (forces aDevelopmentbuild). Can be toggled via thescript-debugginglabel on PR builds or thescript_debugginginput forworkflow_dispatch/workflow_calltriggersReportHub.LogErrorin addition to the user-facing error messageNative code changes
dcl_processes.c/.h— Addeddcl_start_process_blocking()for synchronous child process execution; also fixed aCloseHandleleak inget_process_nameon Windows (handle was closed after the buffer was freed)DCLProcesses.dll/.exp/.lib— Rebuilt native binaries with the new blocking exportDclProcessesNativeMethods.cs— Added managed P/Invoke binding fordcl_start_process_blockingThe built-in Sentry ANR integration is explicitly disabled (
DisableAnrIntegration()) to avoid duplicate detection.Test Instructions
Steps (standard run):
Expected result:
Steps (fresh account):
Expected result:
Prerequisites
Test Steps
/anr-simulatechat command (or/anr-simulate 8000for 8s) to freeze the main thread and trigger ANR detectionDclApplicationNotRespondingExceptionevent with a.dmpfile attachment (ZIP-compressed)/anr-dumpchat command to manually collect a dump and confirm the file paths are printedTools > ProcDump > Dump Currentto verify the editor integration worksenable-sentrylabel to a test PR and verify Sentry is enabled in the resulting buildscript-debugginglabel to a test PR and verify the build includesAllowDebuggingandDevelopmentflagsAdditional Testing Notes
MiniDumpWriteDumptakes longer, the dump will fail gracefullyMiniDumpNormal | WithThreadInfo | WithHandleData | WithUnloadedModulesflags (equivalent to procdump-mt)Quality Checklist
Code Review Reference
Please review our Branch & PR Standards before submitting. It explains the automated review flow, QA/DEV approval requirements, and what each label does — especially useful for first-time contributors.