Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Parallel-WorkUnit CPAN distribution.

Report information
The Basics
Id: 105825
Status: resolved
Priority: 0/
Queue: Parallel-WorkUnit

People
Owner: jmaslak [...] antelope.net
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

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



Subject: Better handling of Storable errors
If the returned data contains something Storable cannot handle, then the error handling is not so good: $ perl5.22.0 -MParallel::WorkUnit -e '$pwu = Parallel::WorkUnit->new; $pwu->async(sub { qr{xxx} }, sub { $res = $_[0] }); $pwu->waitall' Argument "ERROR" isn't numeric in numeric lt (<) at /opt/perl-5.22.0/lib/site_perl/5.22.0/Parallel/WorkUnit.pm line 187, <GEN0> line 2. Magic number checking on storable string failed at /opt/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux/Storable.pm line 420, <GEN0> line 2, at /opt/perl-5.22.0/lib/site_perl/5.22.0/Parallel/WorkUnit.pm line 195. Problem is that $type is already sent to the pipe, and after that the Storable::freeze error happens. It would be better to call Storable::freeze before anything was sent to the pipe, so the error message is much better: Child died with error: Can't store REGEXP items at /opt/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux/Storable.pm line 341, at /tmpfs/.cpan-build/Parallel-WorkUnit-1.001-uA3PDH/blib/lib/Parallel/WorkUnit.pm line 152.
Agreed - thanks for the feedback, I'll see what I can do here.
I fixed the error responses, and provided the line number of the caller that created the thread in the log, since that would help quite a bit with debugging. I used: perl -MParallel::WorkUnit -e '$pwu = Parallel::WorkUnit->new; $pwu->async(sub { qr{xxx} }, sub { $res = $_[0] }); $pwu->waitall' It outputs: Child (created at -e line 1) died with error: Can't store REGEXP items at /usr/local/perlbrew/perls/5.22.0.thread/lib/5.22.0/x86_64-linux-thread-multi/Storable.pm line 341, at /usr/local/perlbrew/perls/5.22.0.thread/lib/site_perl/5.22.0/Parallel/WorkUnit.pm line 203. In the process of fixing this, I found that older Perls actually don't die() when trying to serialize a regex. I didn't spend much time looking to see if they do the right thing (I doubt it), but those tests won't run on older Perls. So I added two tests to the code - one is your test, which is skipped on older Perl, and another that tries to serialize a sub.