Skip Menu |

This queue is for tickets about the future CPAN distribution.

Report information
The Basics
Id: 102165
Status: rejected
Priority: 0/
Queue: future

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

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



Subject: panic: attempt to copy value Future=... to a freed scalar
Been seeing variations of this message on 5.16.x for a while, particularly when debugging (and thus, Carp shortmess compexity) is enabled. However, it appears to be possible to trigger it on 5.20.0 even without PERL_FUTURE_DEBUG set. This seems unfortunate, but perhaps it's fixed in 5.20.2... here's a failing script, maybe I'm doing something wrong here? cheers, Tom
Subject: 2015-02-16-future-panic.t
use strict; use warnings; { package Don't::Panic; use Future; use Future::Utils qw(fmap0); sub new { my $class = shift; bless { pending => [ 3 ] }, $class } sub process { Future->done } sub check_pending { my ($self) = @_; $self->{in_check} ||= do { my $v = ( fmap0 { $self->process(shift) } foreach => $self->{pending} )->on_ready(sub { delete $self->{in_check} }); $v }; } } use Test::More tests => 1; my $thing = Don't::Panic->new; $thing->check_pending; done_testing;
*probably* the same root cause as the linked ticket, which I forgot I'd already opened... maybe this subject is easier to find in searches.
Exactly the same error on 5.20.2 Linux x64 with a clean CPAN version of Future.pm 0.30 (none of my patches applied).
So according to these: https://rt.perl.org/Public/Bug/Display.html?id=50142 "The bug itself has always been present, because items pushed onto the stack aren't reference counted, and so can get prematurely freed. Perl has just got better at detecting this and panicing rather than ploughing on.." https://rt.perl.org/Public/Bug/Display.html?id=121328 "Chalk up another one to "the stack args / @_" aren't reference counted." this is somewhere between "expected behaviour" and "you might get lucky on some future release"...? Anyway, changing things in the code eventually makes the error go away (see patch). Mildly disconcerting but I don't think this is something that Future.pm can really do anything about, so perhaps this ticket should be closed.
Subject: 2015-02-16-future-panic.t.diff
--- /home/tom/dev/gitperl/testcases/2015-02-16-future-panic.t 2015-02-17 00:51:08.502976542 +0000 +++ t/panic.t 2015-02-17 01:06:04.003417089 +0000 @@ -14,16 +14,16 @@ sub process { Future->done } sub check_pending { my ($self) = @_; - $self->{in_check} ||= do { - my $v = ( + unless($self->{in_check}) { + $self->{in_check} = ( fmap0 { - $self->process(shift) + $self->process(shift); } foreach => $self->{pending} )->on_ready(sub { delete $self->{in_check} }); - $v - }; + } + return $self->{in_check} } }
Going to close this since it's due to Perl limitations - keeping @_ items alive is the user's responsibility, Future.pm can't really do anything about that :(