Skip Menu |

This queue is for tickets about the Proc-PID-File CPAN distribution.

Report information
The Basics
Id: 5980
Status: resolved
Priority: 0/
Queue: Proc-PID-File

People
Owner: Nobody in particular
Requestors: Dan [...] DWright.Org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.23
Fixed in: (no value)



Subject: alive() has a race condition.
The alive() method calls read(), which obtains a lock and then releases that lock. Next, alive() calls write(), which obtains a lock and then releases the lock. However, there is an opportunity for another process to obtain a lock between the time that read() and write() are called. This is a race condition. For example: 1. Process A does a read and sees that the pid file is available. 2. Next, process B also does a read and sees that the pid file is available. 3. Now, Process A does a write and thinks that it has obtained a lock on the pid file. 4. However Process B, having already passed the read test, will over-write Process A's lock. 5. At this point, both processes think they have an exclusive lock.
Here is a suggested patch that should fix bugs 5979 and 5980. Regards, -Dan
Download Proc-PID-File-1_23-DIFF
application/octet-stream 2.1k

Message body not shown because it is not plain text.

thanks for the patches. after feedback and some consideration I decided to scrap the OO and procedural interfaces and leave only the simple interface. there really isn't any reason why the other stuff needs to be there. I've thus just release 1.24 in which this bug does not appear.