Skip to content

Commit

Permalink
fix: Rare flush timeout when called in tight loop
Browse files Browse the repository at this point in the history
Fix an edge case that flush could keep timing out when called in a tight
loop. The test case testFlush_WhenNoInternet_BlocksAndFinishes does this
and sometimes fails with 'Flush should not time out'. This is fixed now,
by removing the duplicate setting of isFlushing to NO in two different
synchronize blocks.
  • Loading branch information
philipphofmann committed Aug 8, 2024
1 parent 65e8a5b commit 271a605
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ This bug caused unhandled/crash events to have the unhandled property and mach i
- Don’t force cast to `NSComparisonPredicate` in TERNARY operator (#4232)
- EXC_BAD_ACCESS in SentryMetricProfiler (#4242)
- Missing '#include <sys/_types/_ucontext64.h>' (#4244)
- Rare flush timeout when called in tight loop (#4257)

### Improvements

Expand Down
4 changes: 0 additions & 4 deletions Sources/Sentry/SentryHttpTransport.m
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,6 @@ - (SentryFlushResult)flush:(NSTimeInterval)timeout

intptr_t result = dispatch_group_wait(self.dispatchGroup, dispatchTimeout);

@synchronized(self) {
self.isFlushing = NO;
}

if (result == 0) {
SENTRY_LOG_DEBUG(@"Finished flushing.");
return kSentryFlushResultSuccess;
Expand Down

0 comments on commit 271a605

Please sign in to comment.