Attempts to lock pid files should be non-blocking

Bug #1315507 reported by Ryan Moe
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Undecided
Ryan Moe

Bug Description

When another process already has an exclusive lock on a pid file subsequent attempts to lock will block indefinitely. This is problematic when this happens in e.g the ns-metadata-proxy. When the ns-metadata-proxy blocks on locking its pid file the l3-agent will not be able to bring up any of the router's interfaces.

Revision history for this message
Kevin Benton (kevinbenton) wrote :

This is normally handled with the use of greenthreads. When one thread tries to grab a lock and it is already taken, it will yield to another coroutines. Do you have a reference to the specific location that is blocking?

Revision history for this message
Ryan Moe (rmoe) wrote :

This is where I encountered the issue: https://github.com/openstack/neutron/blob/master/neutron/agent/linux/daemon.py#L40. If another process holds a lock on pidfile the fcntl.flock call will never return. I've also proposed a fix here: https://review.openstack.org/#/c/91890/

Changed in neutron:
status: New → In Progress
Ryan Moe (rmoe)
Changed in neutron:
assignee: nobody → Ryan Moe (rmoe)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/91890
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=797fa55fef2e28cce9dd8f06009217e57bb31e91
Submitter: Jenkins
Branch: master

commit 797fa55fef2e28cce9dd8f06009217e57bb31e91
Author: Ryan Moe <email address hidden>
Date: Fri May 2 13:08:45 2014 -0700

    Make pid file locking non-blocking

    fcntl.flock will block indefinitely if another process holds an exclusive
    lock. A non-blocking flock operation will raise an error when a lock already
    exists so we can fail immediately.

    Closes-bug: 1315507
    Change-Id: Icf97b1f8643157719b3d28ac2c0c1576a5069697

Changed in neutron:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in neutron:
milestone: none → juno-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: juno-1 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.