From: Philipp Hahn <pmhahn@pmhahn.de>
To: linux-kernel@vger.kernel.org
Subject: RFH: stale (f)lock in /proc/locks - process no longer exists
Date: Wed, 14 Oct 2015 10:30:11 +0200 [thread overview]
Message-ID: <561E1293.3050205@pmhahn.de> (raw)
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
next reply other threads:[~2015-10-14 8:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-14 8:30 Philipp Hahn [this message]
2015-10-14 8:53 ` RFH: stale (f)lock in /proc/locks - process no longer exists Philipp Hahn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=561E1293.3050205@pmhahn.de \
--to=pmhahn@pmhahn.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox