Improve Sandbox "owner exited" FAQ #694
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TLDR
Started process need to be terminated while the test process is still running to avoid "owner exited" errors.
More details
I was still running into "owner exited" errors even after following the FAQ's instructions after some investigations I found that automatic
start_supervised!/2
process termination andon_exit/1
callback execution happen after the test process has terminated, this creates a (small) window of time where the test is already dead and the processes are still running.ExUnit's docs state that processes started with
start_supervised!/2
are "guaranteed to exit before the next test starts" and thaton_exit/2
callbacks are run "once the test exits".To completly avoid these errors we need to stop the started processes in the test process (maybe we're missing a
before_exit/1
callback in ExUnit).The issues can be simulated with the following script, to check the suggested fixes uncomment the corresponding code in each test:
Expand Script