Skip to content

sentry/time: fix deadlock in GetTime by avoiding resetLocked under re… - #14162

Closed
Rajkaran-122 wants to merge 1 commit into
google:masterfrom
Rajkaran-122:contrib/fix-sentry-time-read-lock
Closed

sentry/time: fix deadlock in GetTime by avoiding resetLocked under re…#14162
Rajkaran-122 wants to merge 1 commit into
google:masterfrom
Rajkaran-122:contrib/fix-sentry-time-read-lock

Conversation

@Rajkaran-122

@Rajkaran-122 Rajkaran-122 commented Aug 18, 2026

Copy link
Copy Markdown

The GetTime function was calling resetLocked() while holding a read lock, but resetLocked expects a write lock since it modifies the clock state. This could cause a deadlock.

Fix by releasing the read lock before calling reset, which acquires the necessary write lock internally. Also removes the outdated TODO comment about sequence counters.

Fixes #181.

…ad lock

The GetTime function was calling resetLocked() while holding a read lock,
but resetLocked expects a write lock since it modifies the clock state.
This could cause a deadlock.

Fix by releasing the read lock before calling reset, which acquires the
necessary write lock internally. Also removes the outdated TODO comment
about sequence counters.

Fixes google#181.
@EtiennePerot

Copy link
Copy Markdown
Collaborator

The PR looks correct but doesn't match the description. There's no deadlock here, and the issue it claims to fix is about removing the need for locks entirely. A PR that aims to fix it needs to meet that bar.

@Rajkaran-122

Copy link
Copy Markdown
Author

@EtiennePerot sir fixed in please review #14195 the pr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sentry/time: consider a sequence number of read locking

2 participants