-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
ReentrantMutex hangs with fibers, even after 3.11.0 #552
Comments
👋 Seeing as you likely have knowledge of whats going on with fibers in the GraphQL package, can you setup a reproduction without the GraphQL library but just an equivalent usage of Fibers? Is |
Hey @JonRowe, sure thing, I just worked up a minimal reproduction here: rmosolgo@8a32cff Interestingly, I found that I don't think there's any messing with |
I don't this is a problem with |
I actually verified that Speaking of which, why does rspect-support not use |
Speaking of which, why does rspect-support not use Monitor to provide reentrancy?
Off the top of my head, Monitor was introduced after Ruby 1.8.7 that we still support in RSPec 3.
It’s an option to use Monitor, and fall back to ReentrantMutex, or just switch to Monitor in RSpec 4.
Mind sending a PR to the 4-0-dev branch with your patch?
|
Ah I see - makes sense 👍 I wonder if this work is necessary at this point since it is being discussed to remove locks around memoized blocks completely in rspec/rspec-core#2064 I would say let's wait for a decision about what should happen to |
If you research the original development of this you'll find Monitor was actually the source of the original ReentrantMutex definition, with the desired chunks being essentially vendored to remove the dependency on it (we consider anything that requires a |
Subject of the issue
Hi! I'm following up on a reported Rspec hangup with GraphQL-Ruby's "Dataloader," a fiber-based data batching library (Original bug report: rmosolgo/graphql-ruby#4172). The original report also included a replication: khamusa/gql-dataloader-rspec-mocks-hanging@fd6c05b#diff-cd6746fe941432087bd4ad1ba284ce7e6d3f94ef62e3954e8c04fcc007ba3968R3
I see that there has been recent work on this in #503, etc, but even on 3.11.0, I see this stuck process.
I cloned the replication repo and triggered the reported bug, then inspected the stuck ruby process with
rbspy snapshot
, and here's what I saw:Stack trace of stuck ruby process
It seems to me like GraphQL-Ruby is executing a query, which happens inside a newly-created fiber, and then that query calls a mocked method (specifically, a method with a block-style mock), and during that block, it calls a
let(...)
-ed method, and during that call, the process hangs. (Thelet(...)
ed method never returns.)I expect this test to continue running, but is there another way it should be written? (Or, maybe something is out-of-sorts with GraphQL-Ruby's use of Fibers?)
Your environment
Steps to reproduce
Expected behavior
The
let(...)
value should return and the test should continue runningActual behavior
The test hangs forever, with the
rbspy snapshot
pointing at:The text was updated successfully, but these errors were encountered: