-
Notifications
You must be signed in to change notification settings - Fork 3
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
Removed lock file upon receiving interrupt signals #72
Conversation
pleskdistup/main.py
Outdated
@@ -581,6 +593,10 @@ def main(): | |||
printerr(f"{util_name} is ongoing. To check its status, please use `--monitor` or `--status`") | |||
return 1 | |||
|
|||
exit_signal_handler = create_free_lock_exit_signal_handler(lock_file) | |||
for signum in (signal.SIGINT, signal.SIGTERM, signal.SIGHUP, signal.SIGABRT, signal.SIGSEGV): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
signal
documentation states that it makes little sense to catch SIGSEGV.
pleskdistup/main.py
Outdated
def signal_handler(signum, frame): | ||
log.info(f"Received signal {signum}, going to free lockfile {lock_file!r}...") | ||
try: | ||
os.unlink(lock_file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect it could cause double unlink with try_lock()
, producing spurious warning in log, because sys.exit()
will just raise SystemExit
somewhere on the main thread, so try_lock()
exit procedure will be executed too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It actually simplifies things a lot, thx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rebase before merge.
…s upon receiving signals
f7aa6d0
to
8959277
Compare
No description provided.