Skip Menu |

This queue is for tickets about the IPC-ShareLite CPAN distribution.

Report information
The Basics
Id: 92506
Status: rejected
Priority: 0/
Queue: IPC-ShareLite

People
Owner: Nobody in particular
Requestors: arfreitas [...] cpan.org
Cc:
AdminCc:

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



Subject: "uninitialized value in subroutine lock" warning
Greetings, Looks like I got an small bug in IPC::ShareLite. If I opt to use the default lock type for the lock() method, I started getting some warnings during program output: $ ./queue_dequeue3.pl -n 10 -c 2 producer is 4749 producer is 4750 ** producer just got out of the pool with PID 4750 and exit code: 0 consumer is 4752 ** producer just got out of the pool with PID 4749 and exit code: 0 consumer is 4753 Waiting for Children... Use of uninitialized value in subroutine entry at /home/alceu/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/IPC/ShareLite.pm line 361. Use of uninitialized value in subroutine entry at /home/alceu/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/IPC/ShareLite.pm line 361. Use of uninitialized value in subroutine entry at /home/alceu/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/IPC/ShareLite.pm line 361. Use of uninitialized value in subroutine entry at /home/alceu/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/IPC/ShareLite.pm line 361. ** consumer just got out of the pool with PID 4752 and exit code: 0 Use of uninitialized value in subroutine entry at /home/alceu/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/IPC/ShareLite.pm line 361. Use of uninitialized value in subroutine entry at /home/alceu/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/IPC/ShareLite.pm line 361. I took a look at the code mentioned in the warning: sub lock { my $self = shift; my $response = sharelite_lock( $self->{share}, shift() ); return undef if ( $response == -1 ); return 0 if ( $response == 1 ); # operation failed due to LOCK_NB return 1; } Looks like a simple test to see if the shift() returns something would avoid the warning and simplify the call to sharelite_lock(). I was using perl 5.16.3 during the tests. Changing my code to explicit use LOCK_EX resolved the warnings. Regards, Alceu
Messed up the content, will create another ticket.