Skip Menu |
 

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

Report information
The Basics
Id: 126036
Status: resolved
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.15
Fixed in: 0.18



Subject: TODO: handle cx->blk_eval.old_eval_root
Download (untitled) / with headers
text/plain 129b
Seems hard to trigger in unit tests, but in a realworld example it appears to be associated with an END{} block. -- Paul Evans
Download (untitled) / with headers
text/plain 149b
Might all be a consequence of https://rt.cpan.org/Ticket/Display.html?id=126037 so I'll park this one until that is fixed first. -- Paul Evans
Download (untitled) / with headers
text/plain 484b
On Thu Jan 03 10:25:43 2019, PEVANS wrote: Show quoted text
> Might all be a consequence of > > https://rt.cpan.org/Ticket/Display.html?id=126037 > > so I'll park this one until that is fixed first.
Still happening. Test case currently is via Device::Chip::SSD1306 Program runs successfully until exit time, but then aborts $ perl -Mblib examples/ssd1306.pl -A BusPirate:serial=/dev/ttyACM1 -I I2C Future::AsyncAwait panic: TODO: handle cx->blk_eval.old_eval_root Aborted -- Paul Evans
Download (untitled) / with headers
text/plain 442b
Related to the END block: END { print STDERR "ENDing\n"; $chip and $chip->display( 0 )->get; $chip and $chip->power(0)->get; } Causes ENDing Future::AsyncAwait panic: TODO: handle cx->blk_eval.old_eval_root Aborted But by adding at normal program shutdown # Normal controlled shutdown to avoid END $chip->display( 0 )->get; $chip->power(0)->get; undef $chip; Then the problem goes away. -- Paul Evans
Minimal test case turns out to be simple enough -- Paul Evans
Subject: rt126036.pl
Download rt126036.pl
text/x-perl 205b
#!/usr/bin/perl use strict; use warnings; use Future; use Future::AsyncAwait; my $f1 = Future->new; async sub func { await $f1 } END { my $f2 = func(); $f1->done( "OK\n" ); print $f2->get; }
Download (untitled) / with headers
text/plain 375b
A reading of source suggests that we don't need to care about old_eval_root; it's used just to restore lower-down state by the PUSHEVAL and POPEVAL macros. We can just ignore these two fields. Relatedly for similar reasons, we can ignore the blk_eval.cur_text field, and if we do that we gain support for being called from both END {} and string-eval cases. -- Paul Evans
Subject: rt126036.patch
Download rt126036.patch
text/x-diff 1k
=== modified file 'lib/Future/AsyncAwait.xs' --- lib/Future/AsyncAwait.xs 2019-01-04 18:13:42 +0000 +++ lib/Future/AsyncAwait.xs 2019-01-05 19:28:59 +0000 @@ -734,15 +734,18 @@ panic("TODO: handle CXt_EVAL without CXp_TRYBLOCK\n"); if(cx->blk_eval.old_namesv) panic("TODO: handle cx->blk_eval.old_namesv\n"); - if(cx->blk_eval.old_eval_root) - panic("TODO: handle cx->blk_eval.old_eval_root\n"); - if(cx->blk_eval.cur_text) - panic("TODO: handle cx->blk_eval.cur_text\n"); if(cx->blk_eval.cv) panic("TODO: handle cx->blk_eval.cv\n"); if(cx->blk_eval.cur_top_env != PL_top_env) panic("TODO: handle cx->blk_eval.cur_top_env\n"); + /* + * It seems we don't need to care about blk_eval.old_eval_root or + * blk_eval.cur_text, and if we ignore these then it works fine via + * string eval(). + * https://rt.cpan.org/Ticket/Display.html?id=126036 + */ + frame->type = CXt_EVAL; frame->gimme = cx->blk_gimme;
Released in 0.18 -- Paul Evans


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.