Skip to content

Commit 2e8b10e

Browse files
authored
Close two of the zmq pipes at HighThroughputExecutor shutdown (#3525)
This reduces the number of file descriptors left open at the end of pytest parsl/tests/test_htex --config local from 372 fds to 131 fds. This PR does not close the incoming_q ZMQ pipe. A companion PR will close that pipe as part of bigger work to shut down the result management thread, which otherwise continues to use the incoming_q pipe even after shutdown.
1 parent ee4c7b9 commit 2e8b10e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

parsl/executors/high_throughput/executor.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,23 @@ def shutdown(self, timeout: float = 10.0):
834834
logger.info("Unable to terminate Interchange process; sending SIGKILL")
835835
self.interchange_proc.kill()
836836

837+
logger.info("Closing ZMQ pipes")
838+
839+
# These pipes are used in a thread unsafe manner. If you have traced a
840+
# problem to this block of code, you might consider what is happening
841+
# with other threads that access these.
842+
843+
# incoming_q is not closed here because it is used by the results queue
844+
# worker which is not shut down at this point.
845+
846+
if hasattr(self, 'outgoing_q'):
847+
logger.info("Closing outgoing_q")
848+
self.outgoing_q.close()
849+
850+
if hasattr(self, 'command_client'):
851+
logger.info("Closing command client")
852+
self.command_client.close()
853+
837854
logger.info("Finished HighThroughputExecutor shutdown attempt")
838855

839856
def get_usage_information(self):

0 commit comments

Comments
 (0)