Skip Menu |
 

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

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

People
Owner: Nobody in particular
Requestors: nigel.wetters [...] rivalsdm.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.2
Fixed in: (no value)

Attachments
Proc-PID-File-1.3.tar.gz



Subject: DESTROY{} does the wrong thing
This method removes PID files, whether or not they should be deleted. sub DESTROY { my $self = shift; $self->remove() if $self->{path}; } What it is meant to do, is remove the PID file when the owning process exits. However, what it does do is remove the PID file whenever a process exits that has created a Proc::PID::File object (i.e. any process that has called the new() constructor method). Here's where I noticed the problem. 1. First long-running process starts and creates a PID file. 2. Second process starts, calls alive() to see whether another process is running, and exits because of existing PID file. On exit, the DESTROY method is called, which removes the PID file. 3. Third process starts, calls alive() to see whether another process is running, and falsely creates a fresh PID file. The following alteration fixes the bug. Attached is a tarfile, with amended module, Changes, and test.pl which fails under old version and passes under new version. sub DESTROY { my $self = shift; my $pid = $self->read(); $self->remove() if $self->{path} && $pid && $pid == $$; }
Download Proc-PID-File-1.3.tar.gz
application/x-gzip 4.4k

Message body not shown because it is not plain text.

Download (untitled) / with headers
text/plain 373b
[NWETTERS - Mon Oct 28 07:58:19 2002]: have uploaded to PAUSE, as you don't seem to have registered the namespace :) feel free to wallop my upload if it's unsatisfactory -- nwetters@cpan.org Show quoted text
> The following alteration fixes the bug. Attached is a tarfile, with > amended module, Changes, and test.pl which fails under old version > and passes under new version.
Download (untitled) / with headers
text/plain 123b
cleaning up old bugs, found this patch which I've incorporated into rev 1.22. had to rewrite the test suite. thx Nigel !


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.