Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the MCE CPAN distribution.

Report information
The Basics
Id: 89538
Status: resolved
Priority: 0/
Queue: MCE

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

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



Subject: __DIE__ handler is not always correct
I haven't tried the new MCE 1.5, but I've found the previous versions to be very useful. It's a very nice interface for running pool of workers. Thanks for that! However, I think the way MCE handles exceptions from the children isn't entirely correct. It seems to rely on $^S to decide if the exception is going to be trapped or not. But that isn't very reliable. Observe: $SIG{__DIE__} = sub { print $^S }; eval 'die'; # Prints 1 eval 'use BogusModule'; # Prints nothing So if the MCE workers try to load a module that doesn't exist, then the child exits completely even if I wrap it all in eval. perlvar advises against using $^S and suggests using an END block instead. I think that might be a more reliable (and natural) solution here.
Hi Jeffrey, You're correct in that $^S is not reliable from the children. I will commit an update to address this. Thank you for the bug report. Regards, Mario On Tue Oct 15 16:40:22 2013, THALJEF wrote: Show quoted text
> I haven't tried the new MCE 1.5, but I've found the previous versions > to be very useful. It's a very nice interface for running pool of > workers. Thanks for that! > > However, I think the way MCE handles exceptions from the children > isn't entirely correct. It seems to rely on $^S to decide if the > exception is going to be trapped or not. But that isn't very > reliable. Observe: > > $SIG{__DIE__} = sub { print $^S }; > eval 'die'; # Prints 1 > eval 'use BogusModule'; # Prints nothing > > So if the MCE workers try to load a module that doesn't exist, then > the child exits completely even if I wrap it all in eval. > > perlvar advises against using $^S and suggests using an END block > instead. I think that might be a more reliable (and natural) solution > here.
This has been fixed in SVN revision 399 at: https://many-core-engine-perl.googlecode.com/svn/trunk The upcoming MCE 1.501 release will include the change. Thank you, Mario
Subject: Re: [rt.cpan.org #89538] __DIE__ handler is not always correct
Date: Wed, 16 Oct 2013 02:04:39 -0400
To: bug-MCE [...] rt.cpan.org
From: Mario Roy <marioeroy [...] gmail.com>
Hi Jeffrey, MCE 1.501 has been released which addresses the die handler issue. https://metacpan.org/module/MARIOROY/MCE-1.501/lib/MCE.pod MCE 1.5 is a drop-in replacement over 1.4x and earlier releases. Regards, Mario On Tue, Oct 15, 2013 at 4:40 PM, Jeffrey Ryan Thalhammer via RT <bug-MCE@rt.cpan.org> wrote: Show quoted text
> Tue Oct 15 16:40:22 2013: Request 89538 was acted upon. > Transaction: Ticket created by THALJEF > Queue: MCE > Subject: __DIE__ handler is not always correct > Broken in: 1.415 > Severity: (no value) > Owner: Nobody > Requestors: thaljef@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=89538 > > > > I haven't tried the new MCE 1.5, but I've found the previous versions to be very useful. It's a very nice interface for running pool of workers. Thanks for that! > > However, I think the way MCE handles exceptions from the children isn't entirely correct. It seems to rely on $^S to decide if the exception is going to be trapped or not. But that isn't very reliable. Observe: > > $SIG{__DIE__} = sub { print $^S }; > eval 'die'; # Prints 1 > eval 'use BogusModule'; # Prints nothing > > So if the MCE workers try to load a module that doesn't exist, then the child exits completely even if I wrap it all in eval. > > perlvar advises against using $^S and suggests using an END block instead. I think that might be a more reliable (and natural) solution here.
On Tue Oct 15 23:04:58 2013, marioeroy@gmail.com wrote: Show quoted text
> MCE 1.501 has been released which addresses the die handler issue. > https://metacpan.org/module/MARIOROY/MCE-1.501/lib/MCE.pod
That seems to have done the trick -- thanks for that! Using signal handlers in general seems like risky business, since you never know what kind of handlers the user code might be expecting to use. I wonder if there's a way to do it without them.