Skip Menu |

This queue is for tickets about the Try-Tiny CPAN distribution.

Report information
The Basics
Id: 113435
Status: open
Priority: 0/
Queue: Try-Tiny

People
Owner: Nobody in particular
Requestors: mca [...] sanger.ac.uk
Cc:
AdminCc:

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



Subject: Try::Tiny + fatal warnings + qx + Can't exec = fork
Date: Tue, 29 Mar 2016 16:00:32 +0100
To: bug-Try-Tiny [...] rt.cpan.org
From: Matthew Astley <mca [...] sanger.ac.uk>
I found `try` can interfere with Perl's `system` and `qx` builtins, resulting in an accidental fork of the process. The test case is at https://gist.github.com/mcast/f527e7aa36d2ab9788ce#file-plain-system-t I suspect the warning of "Can't exec" is promoted to an error, which is then rescued by try, and this skips some tidying up. Capture::Tiny is no longer implicated, as I first thought. I don't know if it is possible to reduce the case further. It looks like a workaround would be to call POSIX::_exit($? || 1) if $$ changed. This should be enough for a single-threaded process... Hopefully I reported this in the right place. If not, perhaps you can suggest somewhere else I can take the gist? Thanks, -- Matthew -- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.
On 2016-03-29 08:00:55, mca@sanger.ac.uk wrote: Show quoted text
> I found `try` can interfere with Perl's `system` and `qx` builtins, > resulting in an accidental fork of the process. The test case is at > > https://gist.github.com/mcast/f527e7aa36d2ab9788ce#file-plain-system-t > > I suspect the warning of "Can't exec" is promoted to an error, which > is then rescued by try, and this skips some tidying up.
use warnings 1.13 FATAL=>'all'; # weirdly, necessary for the fail This is not weird at all -- fatal warnings turns the failed qx() into an exception. Try::Tiny catches this exception, of course, which then results in the catch block being executed. You'll see the same behaviour, fork and all, when using a plain old eval{} and checking $@.