-
-
Notifications
You must be signed in to change notification settings - Fork 193
Description
As per python docs for os._exit():
Exit the process with status n, without calling cleanup handlers, flushing stdio buffers, etc.
This can cause problems in certain scenarios, for example when the program makes use of multiprocessing libraries.
A good example is when using concurrent.futures
, using any of the Pools (ProcessPoolExecutor
and ThreadPoolExecutor
) causes python to transparently launch a background process for multiprocessing.resource_tracker
, when the program is exiting in an unclean way this causes warnings:
UserWarning: resource_tracker: There appear to be 5 leaked semaphore objects to clean up at shutdown
Presumably this does not actually cause any problems, except that you cannot squash these warnings in any way other than passing -W ignore:semaphore_tracker:UserWarning
to the python interpreter (handling it with modules does not work)
In my testing, replacing that call with the the regular sys.exit()
method completely resolves this issue.