Skip to content

Commit 8cb81dd

Browse files
shutdown: terminate subprocesses
* We use a subprocess pool for running backgorund commands (e.g. `cylc clean`). * This creates subprocesses to run our commands in, however, it does not kill the subprocess once the command has completed, it keeps the subprocess open for future reuse (more efficient than creating and destroying them every time). * On shutdown we need to close the pool to mop up these subprocesses (this doesn't happen automatically).
1 parent 6d95887 commit 8cb81dd

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

changes.d/619.fix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Ensure that subprocesses created by Cylc UI Server are cleaned up correctly when the server shuts down.

cylc/uiserver/app.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,10 +580,17 @@ def launch_instance(cls, argv=None, workflow_id=None, **kwargs):
580580
async def stop_extension(self):
581581
# stop the async scan task
582582
await self.workflows_mgr.stop()
583+
584+
# stop active subscriptions
583585
for sub in self.data_store_mgr.w_subs.values():
584586
sub.stop()
585-
# Shutdown the thread pool executor
587+
588+
# Shutdown the thread pool executor (used for subscription processing)
586589
self.data_store_mgr.executor.shutdown(wait=False)
590+
591+
# stop the process pool (used for background commands)
592+
self.executor.shutdown()
593+
587594
# Destroy ZeroMQ context of all sockets
588595
self.workflows_mgr.context.destroy()
589596
self.profiler.stop()

0 commit comments

Comments
 (0)