forkbreak / fork_break

Fork with breakpoints, for testing multiprocess behaviour.
MIT License
61 stars 6 forks source link

Parent gets EOF exception if child raised exception #1

Closed remen closed 9 years ago

D1plo1d commented 9 years ago

running into the same issue. I would love it if fork_break could surface more useful errors.

remen commented 9 years ago

I'm sorry to say that I've left ruby development behind me at the moment, so this project is more or less abandoned. I would be very happy to give the ownership to someone else. Are you interested?

pedrocarrico commented 9 years ago

This is not trivial, the source of the EOF exception is here in the fork gem and when it arrives at fork_break you can no longer know what happened.

I've already investigated this issue in the past and found no good solution, here's the test I've added in my local fork_break clone in order to tackle this issue:

it "raises the process exception" do

  class MyError < StandardError; end

  process = ForkBreak::Process.new do
    raise MyError
  end

  expect { process.finish.wait }.to raise_error(MyError)
end

If anyone has a good idea I can try and help/review/test/use the code.

D1plo1d commented 9 years ago

Yeah, I don't manage to come up with a good solution either. For my purposes it was enough to wrap the entire fork in a begin rescue block and print the stack trace but that's far from ideal.

@remen Sorry, probably not. Hopefully this project finds a maintainer though. It's been really helpful for integration testing my race condition.

D1plo1d commented 9 years ago

@pedrocarrico Maybe the block could be wrapped in a begin rescue and then the exception message, class and trace sent by some kind of inter-process communication and recreated/raised on the parent process?

pedrocarrico commented 9 years ago

@D1plo1d Yeah that was what I was thinking but at the moment I don't know how fork is structured to do that or if it's even possible.

@remen I can freshen up the repo a bit, perhaps update the gem dependencies (and lock them), do an update to latest rspec, perhaps put up travis build, set up some badges, deal with issue #2, perhaps with all that we can get some more attention to the project and some more collaborators, what do you think?

I also use fork_break extensively at work so I would hate to see it abandoned.

pedrocarrico commented 9 years ago

Well...actually nothing like RTFD (D for documentation on the Fork gem)...I'll put up a pull request for this ASAP.

D1plo1d commented 9 years ago

@pedrocarrico wow, such a simple fix! A+ reading of manuals. Cheers! :)

remen commented 9 years ago

Awesome. Well done!

remen commented 9 years ago

@pedrocarrico Added you as collaborator. If you want me to review code before merging, ping me.