PIDLockFile.acquire() may loop indefinitely

Bug #1472101 reported by Valentine Sinitsyn
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pylockfile
Fix Released
Undecided
Davanum Srinivas (DIMS)

Bug Description

Steps to reproduce:
1. Create PIDLockFile() instance for some random pid file and aquire() it with no timeout value (e.g. PIDLockFile('/tmp/sample.pid').acquire())
2. Repeat it again for the same file.

Expected result: AlreadyLocked exception is raised.

Actual result: The code loops indefinitely.

The problem is likely around line 84 in pidlockfile.py: if timeout is None, you never branch into the code raising exceptions. And timeout can be None if it wasn't specified both in acquire() and during object construction.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to pylockfile (master)

Fix proposed to branch: master
Review: https://review.openstack.org/221123

Changed in pylockfile:
assignee: nobody → Davanum Srinivas (DIMS) (dims-v)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to pylockfile (master)

Reviewed: https://review.openstack.org/221123
Committed: https://git.openstack.org/cgit/openstack/pylockfile/commit/?id=6e9888d592f92319c63ccbd86ea61db32076ae1c
Submitter: Jenkins
Branch: master

commit 6e9888d592f92319c63ccbd86ea61db32076ae1c
Author: Davanum Srinivas <email address hidden>
Date: Mon Sep 7 19:35:30 2015 -0400

    Fix PIDLockFile.acquire() may loop indefinitely

    end_time takes timeout into account, so when time.time()
    does hit the end_time, we should check if timeout was
    set or not and throw either LockTimeout or AlreadyLocked.

    Closes-Bug: #1472101
    Change-Id: I1f369628e765a173ff0cafd01c31eca725b41cae

Changed in pylockfile:
status: In Progress → Fix Committed
Changed in pylockfile:
milestone: none → 0.11.0
status: Fix Committed → Fix Released
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.