Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1246413 > unrolled thread
| Started by | Philipp Hahn <pmhahn@pmhahn.de> |
|---|---|
| First post | 2015-10-14 10:40 +0200 |
| Last post | 2015-10-14 11:00 +0200 |
| Articles | 2 — 1 participant |
Back to article view | Back to linux.kernel
RFH: stale (f)lock in /proc/locks - process no longer exists Philipp Hahn <pmhahn@pmhahn.de> - 2015-10-14 10:40 +0200
Re: RFH: stale (f)lock in /proc/locks - process no longer exists Philipp Hahn <pmhahn@pmhahn.de> - 2015-10-14 11:00 +0200
| From | Philipp Hahn <pmhahn@pmhahn.de> |
|---|---|
| Date | 2015-10-14 10:40 +0200 |
| Subject | RFH: stale (f)lock in /proc/locks - process no longer exists |
| Message-ID | <qjpLk-1t1-33@gated-at.bofh.it> |
Hi, I have several shell scripts using "/usr/bin/flock -x /run/lock/jenkins-ip.lock" to acquiring the exclusive lock. Today they hang, while the lock is owned by a process which no longer exists: # ls -i /run/lock/jenkins-ip.lock 766711440 /run/lock/jenkins-ip.lock # grep 766711440 /proc/locks 1: FLOCK ADVISORY WRITE 1722 00:12:766711440 0 EOF 1: -> FLOCK ADVISORY WRITE 1725 00:12:766711440 0 EOF 1: -> FLOCK ADVISORY WRITE 20432 00:12:766711440 0 EOF 1: -> FLOCK ADVISORY WRITE 20618 00:12:766711440 0 EOF 1: -> FLOCK ADVISORY WRITE 16235 00:12:766711440 0 EOF 1: -> FLOCK ADVISORY WRITE 21757 00:12:766711440 0 EOF 1: -> FLOCK ADVISORY WRITE 29151 00:12:766711440 0 EOF # lslocks -o COMMAND,PID,TYPE,MODE,PATH,BLOCKER COMMAND PID TYPE MODE PATH BLOCKER (unknown) 5852 FLOCK WRITE /run cron 489 FLOCK WRITE /run/crond.pid libvirtd 506 POSIX WRITE /run/libvirtd.pid flock 29151 FLOCK WRITE* /run/lock/jenkins-ip.lock 1722 flock 21757 FLOCK WRITE* /run/lock/jenkins-ip.lock 1722 flock 16235 FLOCK WRITE* /run/lock/jenkins-ip.lock 1722 flock 20618 FLOCK WRITE* /run/lock/jenkins-ip.lock 1722 flock 20432 FLOCK WRITE* /run/lock/jenkins-ip.lock 1722 flock 1725 FLOCK WRITE* /run/lock/jenkins-ip.lock 1722 (unknown) 1722 FLOCK WRITE /run/lock # ps 1722 PID TTY STAT TIME COMMAND # uname -a Linux test4 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u3 (2015-08-04) x86_64 GNU/Linux 1. How can this happen? My understanding is, that all files are closed on process exit and that all locks are released then. Did I miss something. 2. How can I release that lock? Thanks in advance Philipp -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Philipp Hahn <pmhahn@pmhahn.de> |
|---|---|
| Date | 2015-10-14 11:00 +0200 |
| Message-ID | <qjq4H-1PM-29@gated-at.bofh.it> |
| In reply to | #1246413 |
To answer my own question:
Am 14.10.2015 um 10:30 schrieb Philipp Hahn:
> I have several shell scripts using "/usr/bin/flock -x
> /run/lock/jenkins-ip.lock" to acquiring the exclusive lock. Today they
> hang, while the lock is owned by a process which no longer exists:
...
> 1. How can this happen?
> My understanding is, that all files are closed on process exit and
> that all locks are released then. Did I miss something.
I used "{ flock -x 9 } 9<>/var/lock/jenkins-ip.lock": The shell opens
the file, but flock runs in a sub-process; after doing the locking the
process exits and is no longer available, but the locking for the still
opened file persist.
My shell script then received some signals, invoked its trap handler,
which then did some recursive locking.
> 2. How can I release that lock?
Killed the recursive "flock -x" call.
Philipp
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web