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

Stopping is slow #5

Open
paalbra opened this issue Jun 9, 2020 · 0 comments
Open

Stopping is slow #5

paalbra opened this issue Jun 9, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@paalbra
Copy link
Contributor

paalbra commented Jun 9, 2020

Stopping the application might be slow because of the current state a child process is in.

Consider killing of/terminating child processes harder.

for process in processes:
logging.info("Terminating: %s(%d)", process.name, process.pid)
process.terminate()
alive_processes = [process for process in processes if process.is_alive()]
while alive_processes:
process = alive_processes[0]
logging.info("Waiting for: %s(%d)", process.name, process.pid)
log_process_status(processes) # TODO: Too verbose?
process.join(10)
if process.exitcode is None:
logging.warning("Process hanging. Signaling new terminate: %s(%d)", process.name, process.pid)
process.terminate()
time.sleep(1)
alive_processes = [process for process in processes if process.is_alive()]

@paalbra paalbra added the enhancement New feature or request label Jun 9, 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