Repository navigation
opentelemetry-sdk: fix thread leak bug in resource initialization logic - #5706
Merged
emdneto merged 4 commits intoOct 6, 2026
Merged
Conversation
Pull request dashboard statusMerged · refreshed 2026-10-06 13:55 UTC Status above doesn't look right?
|
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
shutdown(wait=True) can make initialization hang indefinitely, removing the documented timeout bound.
Review effort: Lite
Findings: 1
What changed in this PR
Fixes leaked threads from long-running resource detectors by joining executor workers during resource initialization.
Changes:
- Updates executor shutdown behavior.
- Adds regression coverage for worker cleanup.
- Adds a changelog entry.
| File | Summary |
|---|---|
opentelemetry-sdk/tests/resources/test_resources.py |
Tests detector worker-thread cleanup. |
opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py |
Joins detector executor threads. |
.changelog/5706.fixed |
Documents the thread-leak fix. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
pmcollins
reviewed
Sep 30, 2026
emdneto
approved these changes
Oct 5, 2026
lzchen
approved these changes
Oct 6, 2026
pmcollins
approved these changes
Oct 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Fixes bug where threads used for resource detection can be leaked for long running resource detectors.
Fixes #5697
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Tox
Does This PR Require a Contrib Repo Change?
Checklist: