Skip to content
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

Fix TSTP trap #13

Merged
merged 8 commits into from
Feb 10, 2019
Merged

Fix TSTP trap #13

merged 8 commits into from
Feb 10, 2019

Conversation

nevans
Copy link

@nevans nevans commented Feb 7, 2019

This builds on top of #11, and also fixes #10.

compare for just this: nevans/resque-multi-job-forks@fix-tests-resque-v1.26.0...fix-tstp-trap

* Tests use normal fork and communicate with test runner via IO.pipe.
* Tests uses a zero interval to exit ASAP without timeout when done.
* Children need to `exit!` to avoid running test/unit at_exit hooks.
* Gemspec depends on a specific minor version of resque.

We must depend on ~> v1.26.0, because these methods are considered
internal, are not a stable API, and can change with every version. I.e.
as written, the tests do not pass with v1.25.0 nor with v1.27.0. Until
Resque::Worker has a stable API we can target, this gem will need to be
tested with each minor release.
There's a lot of unhelpful noise that comes from running `ruby -w`:
https://mislav.net/2011/06/ruby-verbose-mode/
In tests, `SIGTSTP` is often ignored for ruby 2.3-2.5 (usually works in
2.6?). I assume this has something to do with some signals temporarily
being blocked by ruby, but I'm really not sure.  However, in my tests,
`SIGQUIT` always gets through to the handler.  Since `SIGQUIT` is
normally registered to call `shutdown` anyway, I've simply re-registered
it to continue that role in the `term_child` environment.
This fixes an issue when shutdown order is sent while the first job is
still running.

Also added tests for each of the three common shutdown styles.
@stulentsev stulentsev merged commit fc57b60 into stulentsev:master Feb 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants