Skip to content

fix

ac5c6d1
Select commit
Loading
Failed to load commit list.
Merged

fix(logging): Fix deadlock in log batcher #5684

fix
ac5c6d1
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden completed Mar 17, 2026 in 2m 20s

1 issue

Medium

flush() missing re-entry guard check - `sentry_sdk/_batcher.py:117-122`

The flush() method sets _active.flag = True without first checking if it's already set. Unlike add() which guards with if getattr(self._active, "flag", False): return None, flush() unconditionally sets the flag and proceeds. If _flush() triggers a GC warning that routes back through the logging integration to flush() (instead of add()), the nested flush() will execute, and its finally block will set _active.flag = False prematurely, leaving subsequent re-entrant calls unprotected.

4 skills analyzed
Skill Findings Duration Cost
code-review 0 1m 27s $0.38
find-bugs 1 1m 46s $0.41
skill-scanner 0 1m 6s $0.11
security-review 0 28.1s $0.11

Duration: 4m 47s · Tokens: 651.3k in / 14.8k out · Cost: $1.02 (+extraction: $0.01, +dedup: $0.00)