Skip Menu |

This queue is for tickets about the Log-Log4perl CPAN distribution.

Report information
The Basics
Id: 107610
Status: resolved
Priority: 0/
Queue: Log-Log4perl

People
Owner: Nobody in particular
Requestors: siarhei.kuchynski [...] gmail.com
Cc:
AdminCc:

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



Subject: semget fails when there a semaphore with semid 0
Date: Wed, 7 Oct 2015 21:16:07 +0300
To: bug-Log-Log4perl [...] rt.cpan.org
From: Siarhei Kuchynski <siarhei.kuchynski [...] gmail.com>
Hi When a semaphore with specified key (0x6f6e616e) and semid = 0 already exists, semget fails for this semaphore: bash-4.0# ipcs -s Show quoted text
------ Semaphore Arrays -------- key semid owner perms nsems 0x6f6e616e 0 root 777 1 with the following error message semget(1869504878) failed: at /usr/share/perl5/vendor_perl//Log/Log4perl/Util/Semaphore.pm line 64. This is caused by line 64 of Log::Log4perl::Util::Semaphore.pm 63 print "Semaphore '$self->{key}' already exists\n" if INTERNAL_DEBUG; 64 $self->{id} = semget( $self->{ikey}, 1, 0 ) 65 or die "semget($self->{ikey}) failed: $!"; semget returns ID 0 for the key 1869504878 and dies, though 0 should be considered to be valid ID According to http://perldoc.perl.org/functions/semget.html: *semget KEY,NSEMS,FLAGS* Calls the System V IPC function semget(2). Returns the semaphore id, or the undefined value on error. It seems that init method should call die only if semget returns undefined value, not zero. Could you please take a look? Thanks, Siarhei