Skip to content

Merge branch 'master' into ivana/recursive-guard-in-batcher

261ef0b
Select commit
Loading
Failed to load commit list.
Merged

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

Merge branch 'master' into ivana/recursive-guard-in-batcher
261ef0b
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden: code-review completed Mar 17, 2026 in 1m 0s

1 issue

code-review: Found 1 issue (1 high)

High

Re-entry guard flag not reset on early return, causing spans to be silently dropped - `sentry_sdk/_span_batcher.py:65-66`

When _ensure_thread() returns False or _flusher is None, the function returns at line 66 without entering the try/finally block. This leaves self._active.flag set to True, causing all subsequent calls to add() on the same thread to be silently dropped. Compare with the parent Batcher.add() in _batcher.py where the _ensure_thread() check is inside the try block to ensure the flag is always reset.


Duration: 57.8s · Tokens: 148.0k in / 3.7k out · Cost: $0.23 (+extraction: $0.01, +fix_gate: $0.00)

Annotations

Check failure on line 66 in sentry_sdk/_span_batcher.py

See this annotation in the file changed.

@sentry-warden sentry-warden / warden: code-review

Re-entry guard flag not reset on early return, causing spans to be silently dropped

When `_ensure_thread()` returns `False` or `_flusher is None`, the function returns at line 66 without entering the try/finally block. This leaves `self._active.flag` set to `True`, causing all subsequent calls to `add()` on the same thread to be silently dropped. Compare with the parent `Batcher.add()` in `_batcher.py` where the `_ensure_thread()` check is inside the try block to ensure the flag is always reset.