Subject: | Crash in Sub::Defer |
Date: | Wed, 29 Oct 2014 14:15:55 +0100 |
To: | bug-Moops [...] rt.cpan.org |
From: | Sven Schober <sven.schober [...] uni-ulm.de> |
Hi!
It's me again. :)
I am building a job system using Moops 0.034, where a parent process
fetches some jobs and then spawn a lot of child processes to handle
those jobs.
From time to time, rather seldom (last time it was around 17 times out
of 10k jobs), on of my handlers dies with:
Can't use an undefined value as a SCALAR reference at
/opt/perl5/perls/perl-5.21.0-shared-threaded/lib/site_perl/5.21.0/Sub/Defer.pm
line 21.
I googled around and came across rt#98666 ('Moo: Causing Sub::Defer to
undefer early breaks some optimizations in
Method::Generate::Construtor'), where you are already in contact with
the authors of `Sub::Defer`.
Now, reading up on the documentation for `Sub::Defer::undefer_all()`
[2], I came to the conclusion that this is the thing for me: calling
`undefer_all()` _before_ I start spawning the child processes.
But, this is just a way to trigger the error more reliably:
use strict;
use warnings;
use Carp::Always;
{
use Moops;
class cA {
method BUILD {
print "BUILD\n";
}
}
}
require Sub::Defer;
use Data::Dumper;
print Dumper(\%Sub::Defer::DEFERRED);
Sub::Defer::undefer_all();
This yields:
Can't use an undefined value as a SCALAR reference at
/opt/perl5/perls/perl-5.21.0-shared-threaded/lib/site_perl/5.21.0/Sub/Defer.pm
line 21.
Sub::Defer::undefer_sub("CODE(0x1e23a48)") called at
/opt/perl5/perls/perl-5.21.0-shared-threaded/lib/site_perl/5.21.0/Sub/Defer.pm
line 40
Sub::Defer::undefer_all() called at sub-defer.pl line 17
No wonder, as `"CODE(0x1e23a48)"` points to an empty arrayref:
...
'CODE(0x1e23a48)' => [],
...
Now, I am not sure, if calling `undefer_all()` is the right approach
anyway, and I am not even sure if this is my initial problem, but maybe
you a have suggestion, or pointer as to what is going on?
Please let my know, if I can supply any further information, that might
help clearing things up!
Module versions:
- Perl 5.12.0 (also occuring on 5.18.2)
- Moops 0.034
- Moo 1.006001
Cheers
Sven
[1] https://rt.cpan.org/Public/Bug/Display.html?id=98666
[2] http://search.cpan.org/~haarg/Moo-1.006001/lib/Sub/Defer.pm#undefer_all
--
Dipl.-Inf. Sven Schober
Universität Ulm
kiz - Abteilung Infrastruktur
89069 Ulm
Tel.: +49 731 50 22484
Message body not shown because it is not plain text.