Skip to content

Prevent appHangTimeoutInterval to be set to 0 #7855

@rodolfoBee

Description

@rodolfoBee

Problem Statement

A user ran into performance issues when setting appHangTimeoutInterval to zero, which is allowed by the SDK but offers no value:

appHangTimeoutInterval = 0 becomes a busy loop in SentryANRTrackerV2. The V2 tracker's run loop is:

   NSTimeInterval sleepInterval = self.timeoutInterval / 5;
   while (YES) {
       ...
       [self.threadWrapper sleepForTimeInterval:sleepInterval];
       ...
   }

With timeoutInterval == 0, sleepForTimeInterval:0 returns immediately and the thread pegs a core.

After identifying that the Watchdog termination also enables enableAppHangTracking, the affected user previously set appHangTimeoutInterval = 0 in the app (intending it as a "disable" signal, since SentryHangTrackingIntegration does early-return when the timeout is zero).

However, the Watchdog integration doesn't have the same guard, so it hands 0 straight to the tracker, resulting in a tight loop instead of a no-op.

Solution Brainstorm

Forcing appHangTimeoutInterval to be a value larger than 0 can prevent this configuration issue.

Are you willing to submit a PR?

No response

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions