Skip to content

Commit

Permalink
Merge branch 'main' into fix/crash-in-timezoneEventTriggered
Browse files Browse the repository at this point in the history
  • Loading branch information
philipphofmann committed Jan 2, 2024
2 parents eeb6ddc + 3d3a411 commit 1634638
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- TTFD waits for next drawn frame (#3505)
- Fix TTID/TTFD for app start transactions (#3512): TTID/TTFD spans and measurements for app start transaction now include the app start duration.
- Crash when adding a crumb for a timezone change (#3524)
- Fix a race condition in SentryTracer (#3523)

## 8.17.2

Expand Down
29 changes: 17 additions & 12 deletions Sources/Sentry/SentryTracer.m
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,9 @@ - (void)finishWithStatus:(SentrySpanStatus)status
{
SENTRY_LOG_DEBUG(@"Finished trace with traceID: %@ and status: %@", self.traceId.sentryIdString,
nameForSentrySpanStatus(status));
self.wasFinishCalled = YES;
@synchronized(self) {
self.wasFinishCalled = YES;
}
_finishStatus = status;
[self canBeFinished];
}
Expand All @@ -441,18 +443,21 @@ - (void)canBeFinished
}

BOOL hasUnfinishedChildSpansToWaitFor = [self hasUnfinishedChildSpansToWaitFor];
if (!self.wasFinishCalled && !hasUnfinishedChildSpansToWaitFor && [self hasIdleTimeout]) {
SENTRY_LOG_DEBUG(
@"Span with id %@ isn't waiting on children and needs idle timeout dispatched.",
self.spanId.sentrySpanIdString);
[self dispatchIdleTimeout];
return;
}

if (!self.wasFinishCalled || hasUnfinishedChildSpansToWaitFor) {
SENTRY_LOG_DEBUG(@"Span with id %@ has children but isn't waiting for them right now.",
self.spanId.sentrySpanIdString);
return;
@synchronized(self) {
if (!self.wasFinishCalled && !hasUnfinishedChildSpansToWaitFor && [self hasIdleTimeout]) {
SENTRY_LOG_DEBUG(
@"Span with id %@ isn't waiting on children and needs idle timeout dispatched.",
self.spanId.sentrySpanIdString);
[self dispatchIdleTimeout];
return;
}

if (!self.wasFinishCalled || hasUnfinishedChildSpansToWaitFor) {
SENTRY_LOG_DEBUG(@"Span with id %@ has children but isn't waiting for them right now.",
self.spanId.sentrySpanIdString);
return;
}
}

[self finishInternal];
Expand Down
12 changes: 10 additions & 2 deletions Tests/ThreadSanitizer.sup
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,18 @@ race:monitorCachedData
race:TestThread.m
race:uninstallExceptionHandler

# These methods use Double-Checked Locking and ThreadSanitizers produces
# false alarms for them.
# ------------------ Double Checked Locks ------------------ #
# ThreadSanitizers produces false alarms for double-checked
# locks.

race:getAppStartMeasurement

# SentryDependencyContainer
race:application
race:threadInspector

# ------------------ End: Double Checked Locks -------------- #

# Races to fix
race:returnResponse
race:dispatchAsync
Expand Down

0 comments on commit 1634638

Please sign in to comment.