Repository navigation
Fix lazy attribute method definitiont to be thread safe - #53890
Merged
byroot merged 1 commit intoDec 10, 2024
Merged
Conversation
Fix: rails#53667 Followup: rails#50594 We can't safely check if attribute methods were generated or not as we may be in a race with another thread. As such we must always consider that maybe the mehtod was just generated.
byroot
force-pushed
the
fix-lazy-attr-method-definition-thread-safety
branch
from
December 10, 2024 10:23
3e1e07d to
b458919
Compare
byroot
added a commit
that referenced
this pull request
Dec 10, 2024
…-thread-safety Fix lazy attribute method definitiont to be thread safe
byroot
added a commit
that referenced
this pull request
Dec 10, 2024
…-thread-safety Fix lazy attribute method definitiont to be thread safe
byroot
added a commit
that referenced
this pull request
Dec 10, 2024
…-thread-safety Fix lazy attribute method definitiont to be thread safe
Member
Author
|
Backported to 8.0, 7.2 and 7.1 |
|
Thank you. How is it with the releases? When do you think this could be released? As this multi-thread issue creates a blocker for upgrading and deploying version beyond 7.1.3.4 |
Member
Author
|
Patch releases aren't pre-programmed so I can't answer your question. If you are in a rush, you can point your gemfile to the git repository. |
4 tasks done
skipkayhil
pushed a commit
to hammadxcm/rails
that referenced
this pull request
Aug 13, 2026
…tributes Guard `public_instance_method` call with `public_method_defined?` to avoid raising and rescuing `NameError` for attributes not backed by real columns (e.g. `SELECT 42 AS virtual_attr`). The `NameError` exception allocation + backtrace capture costs ~9μs per call, causing a ~3x regression introduced in rails#53890. This restores performance by using a cheap boolean check on the common path. Fixes rails#57183.
skipkayhil
pushed a commit
to hammadxcm/rails
that referenced
this pull request
Aug 13, 2026
…tributes Guard `public_instance_method` call with `public_method_defined?` to avoid raising and rescuing `NameError` for attributes not backed by real columns (e.g. `SELECT 42 AS virtual_attr`). The `NameError` exception allocation + backtrace capture costs ~9μs per call, causing a ~3x regression introduced in rails#53890. This restores performance by using a cheap boolean check on the common path. Fixes rails#57183.
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.
Fix: #53667
Followup: #50594
We can't safely check if attribute methods were generated or not as we may be in a race with another thread. As such we must always consider that maybe the mehtod was just generated.