-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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: uses ThreadLocal to prevent concurrent modification on ScopeManager #5617
fix: uses ThreadLocal to prevent concurrent modification on ScopeManager #5617
Conversation
…mwja when currently at scope root"
0977c36
to
a4874ea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job identifying the root cause here.
Is it possible to write a unit test for this? Seems like the steps you provided in the description should be pretty straightforward to write a test for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
functional test failure is expected and will be fixed with merging new s3 extension
@filipelautert Nice fix. Would you suppose this makes |
@mches makes sense as now we are always using it, and in a simpler way. |
Impact
Description
Issues #5426 #2433 #4173 #4314 presents the same error: "Cannot end scope bsbacsmwja when currently at scope root" .
The issue was narrowed down to Scope class handling of ScopeManager:
We prevent this issue by using a ThreadLocal object that ensures that each thread will have it's own ScopeManager , so "A" won't break "B" as it cannot mess with it's ScopeManager.
This issue has always been around, but seems it started to show up more as child scopes are being used for blocking tasks (that allows threads switching) such as database execution in ChangelogJdbcMdcListener . In the example above, A and B were suspended waiting for a database query to run.