App Hangs and ANRs for Unreal Engine
Detect app hangs and app-not-responding events in Unreal Engine games.
Unreal Engine uses App Not Responding for mobile UI-thread detection and App Hang for game-thread detection. They are separate feature families with different options and defaults.
Game-thread app hang tracking is disabled by default. You can find these options in Project Settings > Plugins > Sentry > App Hangs, labeled Enable hang tracking, Hang timeout (seconds), and Use native hang tracking:
| Option | Default | Platforms |
|---|---|---|
EnableHangTracking | Disabled | Windows, Linux; required for the native watchdog on all supported platforms |
HangTimeoutDuration | 5 seconds | Windows, Linux, macOS with native backend, Android |
UseNativeHangTracking | Disabled | Windows, Linux, macOS with native backend, Android |
On Windows and Linux, EnableHangTracking uses Unreal Engine's FThreadHeartBeat watcher. It requires HangDuration greater than 0:
DefaultEngine.ini[/Script/Sentry.SentrySettings]
EnableHangTracking=True
[Core.System]
HangDuration=25
[/Script/Sentry.SentrySettings]
EnableHangTracking=True
[Core.System]
HangDuration=25
The engine watcher waits for the greater of HangTimeoutDuration and Unreal Engine's StuckDuration before capturing a stuck thread's stack trace. It uses Unreal Engine's existing heartbeat system plus a Sentry watchdog thread, so it reports any thread that sends engine heartbeats, such as the game thread or the async loading thread. Each stuck thread is reported once.
Since it relies on Unreal Engine's hang detection, the engine watcher doesn't run:
- in editor builds, including Standalone Game or
-gameruns of the editor binary, or in Debug builds - while a debugger is attached, unless you pass
-debughangdetection - when you pass
-nothreadtimeout
Unreal Engine also reports its own hang when a thread is stuck for HangDuration, so keep HangDuration above HangTimeoutDuration.
Enable UseNativeHangTracking to use sentry-native's watchdog instead:
DefaultEngine.ini[/Script/Sentry.SentrySettings]
EnableHangTracking=True
UseNativeHangTracking=True
HangTimeoutDuration=5.0
[/Script/Sentry.SentrySettings]
EnableHangTracking=True
UseNativeHangTracking=True
HangTimeoutDuration=5.0
The native watchdog sends a game-thread heartbeat at the end of every frame and runs a background watchdog thread. It does not require Unreal Engine's heartbeat configuration.
- Detection starts with the first frame, so the SDK doesn't report hangs during startup. After that, blocking loads longer than
HangTimeoutDurationare reported. - On Android, detection pauses while the app is in the background. On desktop platforms, it keeps running while the window is in the background or minimized.
- Each freeze is reported once.
- The native watchdog also runs in the Editor, so pausing at a breakpoint for longer than
HangTimeoutDurationreports an app hang.
On macOS, the native watchdog requires the native backend. On Android, it runs alongside JVM ANR detection, so a freeze that blocks both threads can create an ANR and an AppHang event.
App Not Responding detection is enabled by default on mobile platforms:
| Option | Default | Platforms |
|---|---|---|
EnableAppNotRespondingTracking | Enabled | Android, iOS, macOS with Cocoa backend |
AppNotRespondingTimeout | 5 seconds | iOS, macOS with Cocoa backend, Android below API 30 |
In Project Settings > Plugins > Sentry > App Hangs, these options are under the advanced settings, labeled Enable main thread hang tracking and Main thread hang timeout (seconds).
On iOS and macOS with the default Cocoa backend, they configure Cocoa app hang detection. On macOS with the native backend, use native hang tracking instead. On Android, they configure JVM ANR detection. Android 11 and later reads ANRs from ApplicationExitInfo during a subsequent SDK initialization, so the operating system controls the timeout.
To disable App Not Responding tracking:
DefaultEngine.ini[/Script/Sentry.SentrySettings]
EnableAppNotRespondingTracking=False
[/Script/Sentry.SentrySettings]
EnableAppNotRespondingTracking=False
App hang events use the AppHang mechanism and the tag CrashType:Hang. Search for:
error.mechanism.type:AppHang
error.mechanism.type:AppHang
The two detectors name their events differently, so their issues group separately: the engine watcher reports App Hanging: Application not responding, and the native watchdog reports AppHang: App hung for at least <duration> ms.
Android JVM ANRs use ANR, AppExitInfo, or HistoricalAppExitInfo depending on the Android version and event source.
For native watchdog behavior, see Native SDK app hangs. For mobile platform details, see Android NDK app hang detection and Apple app hangs.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").