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

Report information
The Basics
Id:
131118
Status:
resolved
Priority:
Low/Low

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

BugTracker
Severity:
(no value)
Broken in:
0.33
Fixed in:
0.34



Subject: Occasional unreliable SEGV
Hard to pin down why, but occasionally Device-Chip-CC1101/examples/cc1101.pl will just segv on startup: Program received signal SIGSEGV, Segmentation fault. 0x00007ffff793bb3f in pp_leaveasync (my_perl=<optimized out>) at lib/Future/AsyncAwait.xs:1756 1756 lib/Future/AsyncAwait.xs: No such file or directory. (gdb) bt #0 0x00007ffff793bb3f in pp_leaveasync (my_perl=<optimized out>) at lib/Future/AsyncAwait.xs:1756 #1 0x0000555555652016 in Perl_runops_standard (my_perl=0x5555558a9260) at run.c:42 #2 0x00005555555c662c in S_run_body (oldscope=<optimized out>, my_perl=<optimized out>) at perl.c:2716 #3 perl_run (my_perl=0x5555558a9260) at perl.c:2639 #4 0x000055555559c462 in main (argc=<optimized out>, argv=<optimized out>, env=<optimized out>) at perlmain.c:127 The code in question: 1752 /* Pop extraneous stack items */ 1753 while(SP > oldsp) 1754 POPs; 1755 1756 mPUSHs(ret); 1757 PUTBACK; 1758 1759 if(f) 1760 SvREFCNT_dec(f); The `mPUSHs` call. I wonder if this is some stack pointer issue. -- Paul Evans
Turns out: The `cx` pointer was maybe pointing at some bad data or something, as in gdb it appeared to contain invalid results like large negative values for cx->blku_oldsp, leading to having way too many SVs popped off the stack. Fixed by moving the fetch of `cx = CX_CUR()` until after the (maybe-recursive) call to future_done_from_stack(). The bug doesn't seem to have a reliable test-case, but so far in practice this hasn't repeated itself again now this fix is in place. -- Paul Evans
Subject: rt131118.patch
=== modified file 'lib/Future/AsyncAwait.xs' --- old/lib/Future/AsyncAwait.xs 2019-12-01 00:52:36 +0000 +++ new/lib/Future/AsyncAwait.xs 2019-12-01 01:36:42 +0000 @@ -1712,7 +1712,6 @@ dSP; dMARK; - PERL_CONTEXT *cx = CX_CUR(); SV *f = NULL; SV *ret; @@ -1729,6 +1728,8 @@ ret = future_done_from_stack(f, mark); } + PERL_CONTEXT *cx = CX_CUR(); + SPAGAIN; SV **oldsp = PL_stack_base + cx->blk_oldsp;


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

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