[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#56631: flock does not unlock instantly
From: |
Alexey Kuznetsov |
Subject: |
bug#56631: flock does not unlock instantly |
Date: |
Mon, 18 Jul 2022 13:50:09 +0300 |
Simple bash script:
#!/bin/bashset -eexec 7<"$0"flock -n 7sleep 60
Will prevent a second instance from being executed (exits instantly). But
if the first instance got killed by 'killall test.sh', the second instance
of the script can be executed only after 60 seconds. First instance of the
script does report being killed instantly, but still does not let me run
the second instance of the script. That makes me think, sleep command not
being killed / handled correctly. Here is a work around example, using the
following script makes it work correctly:
#!/bin/bashset -etrap "kill 0" SIGINT SIGTERMexec 7<"$0"flock -n 7sleep 60
Flock waits until sleep finishes, even when the script holding lock is
killed. Is it a bug or feature?
-- AK
- bug#56631: flock does not unlock instantly,
Alexey Kuznetsov <=