馃悰 RelationConnection loads the same relation twice under AsyncDataloader (2.6.7) - #5685
Open
benschwarz wants to merge 1 commit into
Open
馃悰 RelationConnection loads the same relation twice under AsyncDataloader (2.6.7)#5685benschwarz wants to merge 1 commit into
RelationConnection loads the same relation twice under AsyncDataloader (2.6.7)#5685benschwarz wants to merge 1 commit into
Conversation
Refactor load_nodes method to improve node loading logic and handle concurrent access.
Owner
|
Hey, thanks for reporting this and sorry for the trouble 馃槚 I'm hesitant to address this with Do you have a guess why the Fiber is yielding here? Is this a custom connection implementation? |
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.
Given a query like:
Both fields call load_nodes. 2.6.7 runs them concurrently, earlier releases didn't.
Fiber one waits on the DB before setting @nodes. Fiber two sees empty and loads the same relation again. Whichever finishes first clears ActiveRecord's load state from under the other.
This results in:
NoMethodError: undefined method 'instantiate' for nil, plus a duplicate query on every paginated connection.