Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(context): do not modify stack array directly when attach and detach #1760

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tientt-holistics
Copy link

As mentioned in open-telemetry/opentelemetry-ruby/pull/1598

As identified in open-telemetry/opentelemetry-ruby-contrib#772, Rails copies all thread-local variables in ActionController::Live. Our use of an array to back the Context stack results in two threads sharing the same stack. Context.clear only clears the array, but continues to share it (in fact, its effect is visible to both threads), so there is no way to cleanly separate the thread's Context stacks using the public API.

This PR will replace the stack.push and stack.pop with Thread.current assignment

Copy link

linux-foundation-easycla bot commented Nov 14, 2024

CLA Signed

  • ✅login: tientt-holistics / (cd841ef)

The committers listed above are authorized under a signed CLA.

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.

1 participant