馃悰 RelationConnection loads the same relation twice under AsyncDataloader (2.6.7) - #5685
馃悰 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)#5685Conversation
Refactor load_nodes method to improve node loading logic and handle concurrent access.
|
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? |
|
Hey @rmosolgo, fair enough. I am not sure if this is the right fix either, but I was able to get my test suite running with it -- good to open the discussion though. I'm on 1.6.3, and there are seemingly many issues with async dataloader where db connections get used by old/finished/crashed fibres. On 1.6.3 we have a custom Given the updates in 1.6.7 I thought it was worthwhile to see if I could get any joy from it. In using the code in this PR, I was able to upgrade, and also remove the connection releasing dataloader 馃槆 |
|
Thanks for sharing a bit more. I'd love to hear more details (eg error messages, backtraces) about what goes wrong without manual connection handling. Maybe there's a clue in there to an underlying bug! Also, if you find any clues about why |
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.