Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5528 from davecheney/fixedbugs/1588135
worker/terminationworker: fix test hang Fixes LP 1588135 Fix a race on the ownership of the abort signal. The `TestSignal` test attempts to see if sending `SIGABRT` to the test binary itself will cause the worker to unblock itself and exit as exited. However, as the original author discovered there is a race between sending the signal and the worker spawned from `NewWorker` registering a handler to catch `SIGABRT`. If the handler was not registered in time the `SIGABRT` would cause the test process to exit. To fix this problem they set up a `SIGABRT` handler in `SetUpTest` to ensure that `SIGABRT` was always handled. However this meant that if `NewWorker`'s handler was not registered in time to catch the signal, it would be delivered to the channel registered by `SetUpTest`, causing the test binary to hang. The fix is to remove the `SetUpTest` workaround and ensure the handler is always registered before spawning the loop goroutine so the caller is assured that once `NewWorker` has returned, the handler is in place and it is safe to send the signal. This PR also removes unnecessary use of `testing.BaseSuite`. (Review request: http://reviews.vapour.ws/r/4975/)
- Loading branch information