Closed chernenkov-ayu-sbmt closed 4 months ago
Thanks for opening the issue, and very much for the nice reproduction. I don't think the source of this problem is Concurrent Ruby, nor Scientist
I checked out your example. I think the cause is from RSpec let
blocks that have a Mutex and are lazy evaluated. The simplest change to your code would be to use let!
so they are eager-evaluated.
I don't know enough about RSpec to say whether deadlock on let
is expected, undefined, or a bug, but you might search RSpec issues to see if this has been reported and if not, do so. I found it interesting.
Thank you!
Hello! I found deadlock behaviour when I was writing RSpec test for my custom
Scientist::Experiment
implementation (see scientist gem) which useConcurrent::Promises.future
for running observations in parallel. I'm not sure why it happens and how to resolve it. I prepared a small example code which reproduces the deadlock. Please, help!It is interesting, that when I change
let(:experiment_run)
to:then test finishes successfully.
It is also interesting, that in my original code (for the Rails service) doesn't raise
Deadlock
error but hangs forever instead.Context: