-
Notifications
You must be signed in to change notification settings - Fork 257
Description
Thanks in advance for making this Gem 😄. Our team has been enjoying it for a long time.~
However, as we also use Rspec in our automation systems, I found that sometimes our test would fail with a DeadWorker. This DeadWorker makes our investigation a little bit difficult. By digging into your library code more, I found that the fact that our tests would fail with DeadWorker is a consequence of:
- When something like
expect{a}.to be bfail, Rspec will raise a RSpec::Expectations::ExpectationNotMetError, which isn't a StandardError - We are using Parallel with
in_processesso many of our code will be executed on a forked process. - The rescue in https://github.com/grosser/parallel/blob/master/lib/parallel.rb#L472 doesn't seem to catch the RSpec::Expectations::ExpectationNotMetError as it isn't a StandardError.
- The process died out, and the worker failed to read the file. When this happened, DeadWorker from (https://github.com/grosser/parallel/blob/master/lib/parallel.rb#L74) will be the final thing recorded.
I have a small example so you could also have a try:
require 'rspec/expectations'
require 'parallel'
# This line will fail and the last thing in the rspec report is a Parallel::DeadWorker
Parallel.each(1..1, in_processes:1) {|x| raise RSpec::Expectations::ExpectationNotMetError}
# This line will leave the correct exception as the exception happens in the main process and 'kills' the process
Parallel.each(1..1, in_threads:1) {|x| raise RSpec::Expectations::ExpectationNotMetError}I tried to make a small change that lets the rescue (https://github.com/grosser/parallel/blob/master/lib/parallel.rb#L472) to catch Exception and after the changes, our annoying DeadWorker was resolved.
As I don't really know the designing details of process_incoming_jobs, this Issue is mainly for asking:
- Are there any concerns so that you guys didn't choose to rescue all the exceptions in process_incoming_jobs?
- We could patch what we need in our own system. But do you think it is worthy to modify the process_incoming_jobs so it could catch
Exception? Or is there any other thing that might be better? We benefit from the open source community a lot so I would like to submit a PR for this. Feels like this could be something that everyone could run into, especially when using libraries such as Rspec that raises non-StandardError.