Skip to content

Merge branch 'master' into ivana/fixup-strawberry-integration

4d8969e
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Merged

ref(strawberry): Simplify span creation #5647

Merge branch 'master' into ivana/fixup-strawberry-integration
4d8969e
Select commit
Loading
Failed to load commit list.
GitHub Actions / warden: find-bugs completed Mar 12, 2026 in 1m 53s

1 issue

find-bugs: Found 1 issue (1 medium)

Medium

Span context manager not properly closed on exception - span leaks and scope corruption - `sentry_sdk/integrations/strawberry.py:189-204`

The new code calls self.graphql_span.__enter__() at line 189 and self.graphql_span.__exit__(None, None, None) at line 204, but if an exception is thrown into the generator at the yield statement (line 196), the code after yield never executes. This leaves the span unfinished and corrupts the scope because __exit__ restores the old span. Additionally, passing (None, None, None) to __exit__ prevents the span from being marked with INTERNAL_ERROR status when an exception occurs.


Duration: 1m 52s · Tokens: 385.6k in / 5.0k out · Cost: $0.42

Annotations

Check warning on line 204 in sentry_sdk/integrations/strawberry.py

See this annotation in the file changed.

@github-actions github-actions / warden: find-bugs

Span context manager not properly closed on exception - span leaks and scope corruption

The new code calls `self.graphql_span.__enter__()` at line 189 and `self.graphql_span.__exit__(None, None, None)` at line 204, but if an exception is thrown into the generator at the `yield` statement (line 196), the code after `yield` never executes. This leaves the span unfinished and corrupts the scope because `__exit__` restores the old span. Additionally, passing `(None, None, None)` to `__exit__` prevents the span from being marked with `INTERNAL_ERROR` status when an exception occurs.