You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The PidFile class registers close() to be called at process exit time, but if the user manually calls close(), this can lead to a race condition where Instance A of a script closes the pid file and instance Instance B of the same script is allowed to run, but A delete's B's pid file.
Pseudo Code
pid_file=PidFile(...)
try:
pid_file.create()
exceptException:
ifnotpid_file.filenameornotos.path.exists(pid_file.filename):
raiseraiseMyAlreadyRunningErrortry:
do_something()
finally:
pid_file.close()
# A hasn't called at exit yet, but B is allowed to run# Shortly later, A exits and A's `atexit` closes the pid file that B creates
It would be possible to not call close(), but we have tests to check for MyAlreadyRunningError and pytest does not exit (therefore never calls the registered atexit handlers) until after the full suite of test has been run.
The text was updated successfully, but these errors were encountered:
The PidFile class registers
close()
to be called at process exit time, but if the user manually callsclose()
, this can lead to a race condition where Instance A of a script closes the pid file and instance Instance B of the same script is allowed to run, but A delete's B's pid file.Pseudo Code
It would be possible to not call
close()
, but we have tests to check for MyAlreadyRunningError and pytest does not exit (therefore never calls the registeredatexit
handlers) until after the full suite of test has been run.The text was updated successfully, but these errors were encountered: