fix(opentelemetry): resolve thread-unsafe iter#18178
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 48199bc104
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
brettlangdon
left a comment
There was a problem hiding this comment.
can you add a release note for this?
|
Is this due to something I did, or something in the CI process? I can't access the link update: this may be because my commit was unverified? I set up verification and rebased with a signed commit |
Wrap `dd_baggage.items()` and `otel_baggage.items()` with `list()` in `get_current()` and `attach()` to prevent `RuntimeError: dictionary changed size during iteration` when multiple threads concurrently read and mutate shared baggage dicts via OTel context propagation. Closes DataDog#16523
|
The commit is now signed: and the links in the CI message don't work for me, they seem to be private pages. GitHub shows the commit as verified. If you want to make the commit yourself because CI won't let me, I won't be offended |
Description
Wrap
dd_baggage.items()andotel_baggage.items()withlist()inget_current()andattach()to preventRuntimeError: dictionary changed size during iterationwhen multiple threads concurrently read and mutate shared baggage dicts via OTel context propagation.Closes #16523
Testing
added a test and verified that the tests pass
Risks
Adds an additional allocation in
get_currentandattachAdditional Notes
I made this PR with the assistance of AI, but have read it and think I understand it well enough to suggest it