Skip Menu |

This queue is for tickets about the Future-AsyncAwait CPAN distribution.

Report information
The Basics
Id: 129320
Status: rejected
Priority: 0/
Queue: Future-AsyncAwait

People
Owner: Nobody in particular
Requestors: leonerd-cpan [...] leonerd.org.uk
Cc:
AdminCc:

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



Subject: panic: TODO: Unsure how to handle savestack entry of [SAVEt_FREEPV]
(from https://rt.cpan.org/Ticket/Display.html?id=129316) Happens via Device::BusPirate on pre-5.24 perls: $ perl5.22.2 Build test ... t/20spi.t ..... 1/? Future::AsyncAwait panic: TODO: Unsure how to handle savestack entry of 10 t/20spi.t ..... All 4 subtests passed t/30i2c.t ..... 1/? # Failed test '->read returns bytes' # at t/30i2c.t line 76. # got: 'V' # expected: 'Vx' # Failed test '->read: all methods called' # at t/30i2c.t line 79. Expected syswrite("04"), got ("03") at /home/leo/src/perl/Device-BusPirate/blib/lib/Device/BusPirate.pm line 152. # Tests were run but no plan was declared and done_testing() was not seen. # Looks like your test exited with 255 just after 8. TODO: free saved slot type 49 TODO: free frame->itervar t/30i2c.t ..... Dubious, test returned 255 (wstat 65280, 0xff00) Failed 2/8 subtests $ grep 10 v5.22.0/scope.h #define SAVEt_FREEPV 10 $ grep 49 v5.22.0/scope.h #define SAVEt_PADSV_AND_MORTALIZE 49 The two fails may or maynot be related. -- Paul Evans
On Fri Apr 26 08:21:13 2019, PEVANS wrote: Show quoted text
> The two fails may or maynot be related.
Turns out they're unrelated. Even with all the TODOs fixed (patch attached), the actual value test still fails: $ perl5.22.2 Build test t/00use.t ..... ok t/01serial.t .. ok t/10bbio.t .... ok t/20spi.t ..... ok t/30i2c.t ..... 1/? # Failed test '->read returns bytes' # at t/30i2c.t line 76. # got: 'V' # expected: 'Vx' # Failed test '->read: all methods called' # at t/30i2c.t line 79. Expected syswrite("04"), got ("03") at /home/leo/src/perl/Device-BusPirate/blib/lib/Device/BusPirate.pm line 152. # Tests were run but no plan was declared and done_testing() was not seen. # Looks like your test exited with 255 just after 8. t/30i2c.t ..... Dubious, test returned 255 (wstat 65280, 0xff00) Failed 2/8 subtests t/99pod.t ..... skipped: Test::Pod 1.00 required for testing POD Test Summary Report ------------------- t/30i2c.t (Wstat: 65280 Tests: 8 Failed: 2) Failed tests: 6-7 Non-zero exit status: 255 Parse errors: No plan found in TAP output Files=6, Tests=39, 0 wallclock secs ( 0.04 usr 0.00 sys + 0.39 cusr 0.02 csys = 0.45 CPU) Result: FAIL Failed 1/6 test programs. 2/39 subtests failed. -- Paul Evans
Subject: rt129320-a1.patch
=== modified file 'lib/Future/AsyncAwait.xs' --- lib/Future/AsyncAwait.xs 2019-04-25 16:38:38 +0000 +++ lib/Future/AsyncAwait.xs 2019-04-26 13:37:56 +0000 @@ -373,6 +373,14 @@ case SAVEt_SET_SVFLAGS: break; + case SAVEt_FREEPV: + Safefree(saved->cur.ptr); + break; + + case SAVEt_PADSV_AND_MORTALIZE: + SvREFCNT_dec(saved->cur.sv); + break; + default: fprintf(stderr, "TODO: free saved slot type %d\n", saved->type); break; @@ -385,8 +393,10 @@ /* TODO: maybe free items of the el.loop */ #ifdef HAVE_ITERVAR - if(frame->itervar) - fprintf(stderr, "TODO: free frame->itervar\n"); + if(frame->itervar) { + SvREFCNT_dec(frame->itervar); + frame->itervar = NULL; + } #endif if(frame->mortals) { @@ -520,6 +530,16 @@ break; } + case SAVEt_FREEPV: { + PL_savestack_ix -= 2; + char *pv = PL_savestack[PL_savestack_ix].any_ptr; + + saved->type = SAVEt_FREEPV; + saved->saved.ptr = pv; + + break; + } + case SAVEt_FREESV: { PL_savestack_ix -= 2; void *sv = PL_savestack[PL_savestack_ix].any_ptr; @@ -1186,6 +1206,10 @@ PL_curpad = PL_comppad ? AvARRAY(PL_comppad) : NULL; break; + case SAVEt_FREEPV: + save_freepv(saved->saved.ptr); + break; + case SAVEt_FREESV: save_freesv(saved->saved.sv); break; @@ -1214,13 +1238,11 @@ #endif case SAVEt_PADSV_AND_MORTALIZE: - /* PL_curpad[saved->u.padix] = saved->saved.sv; save_padsv_and_mortalize(saved->u.padix); SvREFCNT_dec(PL_curpad[saved->u.padix]); PL_curpad[saved->u.padix] = saved->cur.sv; - */ break; case SAVEt_SET_SVFLAGS: === added file 't/13regexp.t' --- t/13regexp.t 1970-01-01 00:00:00 +0000 +++ t/13regexp.t 2019-04-26 13:40:30 +0000 @@ -0,0 +1,29 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More; + +use Future; + +use Future::AsyncAwait; + +# Try to trigger SAVEt_FREEPV +{ + my $f1 = Future->new; + my $fret = (async sub { + my $bytes = "abcdefghijklmnopq"; + my $maxchunk = 6; + my @chunks = $bytes =~ m/(.{1,$maxchunk})/gs; + my $ret = ""; + + await $f1; + return scalar @chunks; + })->(); + + $f1->done; + is( scalar $fret->get, 3, 'chunks' ); +} + +done_testing; === modified file 't/42unresolved.t' --- t/42unresolved.t 2019-04-24 14:31:16 +0000 +++ t/42unresolved.t 2019-04-26 12:54:17 +0000 @@ -69,6 +69,15 @@ 'warning from attempted resume' ); } +# abandoned foreach loop (RT129320) +{ + my $f1 = Future->new; + my $fret = (async sub { foreach my $f ($f1) { await $f } })->(); + + undef $fret; + pass( "abandoned foreach loop does not crash" ); +} + is( Future::AsyncAwait::__cxstack_ix, $orig_cxstack_ix, 'cxstack_ix did not grow during the test' );
I believe this is a return of RT129215. If I apply the previous workaround (using a temporary array rather than stack temporaries) then the problem goes away. Seems like 129215 wasn't as fixed as we thought. -- Paul Evans
On Fri Apr 26 10:01:37 2019, PEVANS wrote: Show quoted text
> I believe this is a return of RT129215. If I apply the previous > workaround (using a temporary array rather than stack temporaries) > then the problem goes away. > > Seems like 129215 wasn't as fixed as we thought.
By adding the same panic-assertion as for the 5.24+ case, this fails in the same way: $ perl5.22.2 Build test t/00use.t ..... ok t/01serial.t .. ok t/10bbio.t .... ok t/20spi.t ..... ok t/30i2c.t ..... 1/? Future::AsyncAwait panic: ARGH CXt_LOOP_FOR/stacklist frame tried to steal stack values t/30i2c.t ..... All 5 subtests passed t/99pod.t ..... skipped: Test::Pod 1.00 required for testing POD Test Summary Report ------------------- t/30i2c.t (Wstat: 6 Tests: 5 Failed: 0) Non-zero wait status: 6 Parse errors: No plan found in TAP output Files=6, Tests=36, 1 wallclock secs ( 0.04 usr 0.00 sys + 0.39 cusr 0.03 csys = 0.46 CPU) Result: FAIL Failed 1/6 test programs. 0/36 subtests failed. I think therefore this bug can be closed as a duplicate of the reƤnimated RT129215 -- Paul Evans