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

Properly cleanup processes in case of conduit failing with an exception #80

Open
qrilka opened this issue Jun 14, 2020 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@qrilka
Copy link
Collaborator

qrilka commented Jun 14, 2020

Tests in #76 uncovered that if an exception gets thrown in a hatrace conduit child processes don't get cleaned up correctly. Quoting @nh2 from discord:

...currently an exception being thrown and not caught from inside the Conduit will leak the tracee child process. That is because

genericSourceTraceForkExecvFullPathWithSink args getDetails sink = runInBoundThread $ do
  childPid <- liftIO $ forkExecvWithPtrace args

does not use any form of bracket.
What this needs is the same form of bracket that the sourceProcessWithStreams (https://hackage.haskell.org/package/conduit-extra-1.3.5/docs/Data-Conduit-Process.html#v:sourceProcessWithStreams) does:

If an exception is raised by any of the streams, the process is terminated.

It is not implemented because I haven't figured out exactly yet how to "just kill" a traced process. Maybe it's easy, but I am not sure.
We should certainly have an issue about it (currently we don't have yet).

@qrilka qrilka added the enhancement New feature or request label Jun 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant