Skip to content

fix: close the owned Sentry client during teardown - #464

Merged
lesnik512 merged 1 commit into
mainfrom
fix/close-owned-sentry-client
Nov 15, 2026
Merged

lesnik512 merged 1 commit into
mainfrom
fix/close-owned-sentry-client

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Sentry teardown previously flushed the current client and detached it without closing the client initialized by the instrument. Retain that owned client and close it with the existing two-second timeout. Clear the global binding only if it still refers to that client, preserving replacements even when cleanup raises.

Add regression tests for transport shutdown, the timeout, replacement clients, flush and kill failures, and repeated teardown. Document the async transport scope: callers must await client.close_async(timeout=2) before synchronous teardown. Validate that path with a real AsyncHttpTransport.

Validation: 686 tests pass with 100% line coverage; Ruff, ty 0.0.100, and the strict docs build pass. Standards and spec reviews found no issues.

Closes #454.

@lesnik512
lesnik512 merged commit 193a6e8 into main Nov 15, 2026
35 checks passed
@lesnik512
lesnik512 deleted the fix/close-owned-sentry-client branch November 15, 2026 11:14
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.

[P2] Close the Sentry client owned by the instrument at teardown

1 participant