-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Don't nest Async primitives inside plain Ruby fibers #5479
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
base: master
Are you sure you want to change the base?
Conversation
|
Sad, it seems like the test suite hangs now... |
b04fa42 to
983d1fb
Compare
|
Ok, I think the problem was that Fiber / Task nesting. I reworked it so that each pass over the set of pending dataloader fibers spins up a new job. This avoids any mixing between Async primitives and plain Ruby Fibers. It messed up some of the fiber counting tests though -- I'll sort them out in the morning. @iyotov-havelock, could you try this branch in your app's test suite and development? You can bundle it with: gem "graphql", github: "rmosolgo/graphql-ruby", ref: "async-dataloader-deadlock-fix"please let me know how it goes! |
|
Hey @rmosolgo, thanks for checking this issue out. Tested it with my 'real' app in development, sadly there's still an issue there: Tested it with the demo app (https://github.com/iyotov-havelock/async-dataloader-issue), the |
|
I saw that error, too, and assumed that GraphQL was "working," since it called code as expected. Inspecting the dataset, I see that it was passed the right values: My hunch is that Async + Sequel aren't playing nice here ... but do you have a reason to think that AsyncDataloader in particular is the cause of the issue? Could you please share the full stack trace (NOT a screenshot) from the error in your application? Maybe some lines there will be a clue. Also, if you can modify the replication app so that it deadlocks on this branch, I'd be happy to keep debugging on that. UPDATE: I got the example to run successfully by adding the fiber_concurrency extension: diff --git a/config/database.rb b/config/database.rb
index 16f3b03..7ec45a8 100644
--- a/config/database.rb
+++ b/config/database.rb
@@ -1,4 +1,5 @@
require 'sequel'
+Sequel.extension :fiber_concurrency
DB = Sequel.connect(
adapter: 'postgres',Have you tried that extension in your app? I found it by searching randomly around the Sequel repo for the word "Fiber"... With that addition, I get: |

Fixes #5463