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 threading issue with strict locals #50775

Merged
merged 1 commit into from
Jan 18, 2024
Merged

Conversation

mockdeep
Copy link
Contributor

Fixes #50774

When the server boots up, 2 threads hit the same UnboundTemplate
instance before it has set up @templates. Both threads get past the
unless template = @templates[locals] check because
@templates[locals] isn't set yet. However, with @write_lock, one
thread waits while the other one proceeds, setting @templates to a
frozen hash. The second thread then gets the write lock and tries to
modify @templates but it has been frozen.

Fixes rails#50774

When the server boots up, 2 threads hit the same `UnboundTemplate`
instance before it has set up `@templates`. Both threads get past the
`unless template = @templates[locals]` check because
`@templates[locals]` isn't set yet. However, with `@write_lock`, one
thread waits while the other one proceeds, setting `@templates` to a
frozen hash. The second thread then gets the write lock and tries to
modify `@templates` but it has been frozen.
@rails-bot rails-bot bot added the actionview label Jan 17, 2024
@mockdeep
Copy link
Contributor Author

Not sure why buildkite is failing. It's complaining about a missing config.

@rafaelfranca rafaelfranca merged commit 5703463 into rails:main Jan 18, 2024
4 checks passed
rafaelfranca added a commit that referenced this pull request Jan 18, 2024
Fix threading issue with strict locals
@mockdeep mockdeep deleted the rf-thread_fix branch January 18, 2024 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Threading issue with strict locals in ActionView
2 participants