Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Spawn processes in executor with tokio-process #3

Merged
merged 1 commit into from Nov 23, 2017

Conversation

gandro
Copy link
Member

@gandro gandro commented Nov 20, 2017

This is a first PR for the process management, further moving away from using threads and integrating more of tokio.

This PR adds tokio-{process,signal} as additional dependencies, allowing us to easily handle both SIGCHILD and SIGTERM on Unix executors in a portable way.

SIGCHILD is needed such that the spawned queries/jobs are properly reaped by their parent executor upon completion, this was previously done through a dedicated thread calling Child::wait.

SIGTERM has not been handled so far, which meant that jobs would outlive their executor. This PR changes this behaviour such that all spawned jobs are killed (through the drop impl of tokio-process) when shutting down.

This allows us to reduce the number of threads needed when managing
spawned jobs. This commit also introduces the use of tokio-process
to properly handle SIGTERM in an executor, which drops (and therefore
kills) all the child processes upon exit.

Signed-off-by: Sebastian Wicki <swicki@inf.ethz.ch>
@gandro gandro requested a review from antiguru November 21, 2017 14:53
Copy link
Member

@antiguru antiguru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine.

@gandro gandro merged commit 99691d1 into strymon-system:master Nov 23, 2017
@gandro gandro mentioned this pull request Nov 23, 2017
@gandro gandro deleted the tokio-process branch November 30, 2017 16:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants