public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Philipp Hahn <pmhahn@pmhahn.de>
To: linux-kernel@vger.kernel.org
Subject: Re: RFH: stale (f)lock in /proc/locks - process no longer exists
Date: Wed, 14 Oct 2015 10:53:57 +0200	[thread overview]
Message-ID: <561E1825.8010500@pmhahn.de> (raw)
In-Reply-To: <561E1293.3050205@pmhahn.de>

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

      reply	other threads:[~2015-10-14  8:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-14  8:30 RFH: stale (f)lock in /proc/locks - process no longer exists Philipp Hahn
2015-10-14  8:53 ` Philipp Hahn [this message]

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=561E1825.8010500@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