Skip to content
Gleb edited this page Jan 23, 2024 · 2 revisions

Hangs

A hang is a state where a thread (the main thread in our context) becomes blocked, preventing it from continuing execution. This can occur due to various reasons, such as waiting for a synchronous operation to complete, deadlocks, or excessive computational load on the thread or even an infinite loop.

Non-Fatal Hang

This type of hang temporarily blocks the main thread (current threshold is 2 seconds) but eventually recovers without terminating the app. It usually results in the app becoming unresponsive for a period of time before returning to normal. However, it significantly degrades the user experience.

These hangs can also be noticed by the Freeze Time metric, but here we also provide stack traces for further investigations.

Fatal Hang

A fatal hang occurs when the main thread is blocked and does not recover. This often leads to the termination of the app by the system watchdog, as iOS terminates any application that doesn't respond to user input within a certain time limit. We also track fatal hang if user kills our app during the time when main thread is unresponsive.

Startup Hang

This is a specific type of hang that occurs during the startup of the application. Startup fatal hangs prevent the app from even launching properly, resulting in immediate app termination by the system. System usually gives our app 30 seconds to be launched. If it doesn't finish after this time, startup fatal hang will be reported.

Startup non-fatal hangs are covered also by Startup Time metric, so we ignore those at Booking.

Implementation

To get hang events you should implement HangsReceiver protocol and receive HangInfo struct you can check duringStartup flag and read callStack.

Stack trace symbolication

In the release version of the app we do not have symbols (method and classes names), so stack trace will not have symbols there, only addresses. To make it readable you should symbolicate it. For now we send non-symbolicated stack traces to our BE and symbolicate there manually on Mac with the help of atos utility.

We are also submitting those stack traces to Firebase as non-fatal errors, to get symbolication for free by Firebase Crashlytics.

Clone this wiki locally