Skip Menu |
Report information
Id: 128594
Status: resolved
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: autarch <autarch [at] urth.org>
ddgreen [at] gmail.com
rob [at] hoelz.ro
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: Reading from Proc.out after using :merge with shell() segfaults
See the attached script.
Subject: test.pl
Download test.pl
text/x-perl 63b
use v6; my $p = shell('ls', :out, :merge); $p.out.slurp-rest
Subject: Core dump from run( ..., :merge) and trying to get output
Download (untitled) / with headers
text/plain 169b
use v6; my $proc = run( 'echo', 'hello', :out, :merge ); say $proc.out.slurp-rest; Removing the :merge eliminates the core dump. This is with the latest Rakudo on moar.
Subject: [SEGV] attempting to use :merge when run()ning an external command causes a core dump
Download (untitled) / with headers
text/plain 5.4k
perl6 --version This is Rakudo version 2016.06-220-g2ad3239 built on MoarVM version 2016.06-11-gf9dad06 implementing Perl 6.c. perl6 -e 'my $p = run "cat", "asdf", :err; say $p.err.slurp-rest.perl' "cat: asdf: No such file or directory\n" perl6 -e 'my $p = run "cat", "asdf", :out; say $p.out.slurp-rest.perl' "" perl6 -e 'my $p = run "cat", "asdf", :out, :merge; say $p.out.slurp-rest.perl' Aborted (core dumped) perl6 -e 'my $p = run "cat", "asdf", :out, :err, :merge; say $p.out.slurp-rest.perl' Aborted (core dumped) perl6 -e 'my $p = run "cat", "asdf", :out, :err, :merge; say $p.err.slurp-rest.perl' Aborted (core dumped) perl6 -e 'my $p = run "cat", "asdf", :err, :merge; say $p.err.slurp-rest.perl' Aborted (core dumped) perl6 -e 'my $p = run "cat", "asdf", :merge; say $p.out.slurp-rest.perl' Aborted (core dumped) perl6-valgind-m -e 'my $p = run "cat", "asdf", :merge; say $p.out.slurp-rest.perl' ... ==1374== Invalid read of size 8 ==1374== at 0x50671AA: uv__io_start (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x506EE83: uv_read_start (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x4FC6249: MVM_io_syncstream_slurp (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x4FC3D9D: MVM_io_slurp (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x4F8EC97: MVM_interp_run (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x5051248: MVM_vm_run_file (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x400F63: main (in /home/dan/Source/perl6/install/bin/moar) ==1374== Address 0x618d668 is 8 bytes before a block of size 128 alloc'd ==1374== at 0x4C2ABD0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==1374== by 0x4C2CA9E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==1374== by 0x5067139: uv__io_start (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x506D170: uv_signal_init (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x506AF36: uv_loop_init (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x5065AC3: uv_default_loop (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x4F9E9A4: MVM_tc_create (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x505093C: MVM_vm_create_instance (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x400D40: main (in /home/dan/Source/perl6/install/bin/moar) ==1374== ==1374== Invalid write of size 8 ==1374== at 0x5067200: uv__io_start (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x506EE83: uv_read_start (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x4FC6249: MVM_io_syncstream_slurp (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x4FC3D9D: MVM_io_slurp (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x4F8EC97: MVM_interp_run (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x5051248: MVM_vm_run_file (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x400F63: main (in /home/dan/Source/perl6/install/bin/moar) ==1374== Address 0x618d668 is 8 bytes before a block of size 128 alloc'd ==1374== at 0x4C2ABD0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==1374== by 0x4C2CA9E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==1374== by 0x5067139: uv__io_start (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x506D170: uv_signal_init (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x506AF36: uv_loop_init (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x5065AC3: uv_default_loop (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x4F9E9A4: MVM_tc_create (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x505093C: MVM_vm_create_instance (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x400D40: main (in /home/dan/Source/perl6/install/bin/moar) ==1374== ==1374== ==1374== Process terminating with default action of signal 6 (SIGABRT): dumping core ==1374== at 0x54D1295: raise (in /usr/lib/libc-2.23.so) ==1374== by 0x54D26D9: abort (in /usr/lib/libc-2.23.so) ==1374== by 0x506293D: uv__io_poll (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x50668CF: uv_run (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x4FC6277: MVM_io_syncstream_slurp (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x4FC3D9D: MVM_io_slurp (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x4F8EC97: MVM_interp_run (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x5051248: MVM_vm_run_file (in /home/dan/Source/perl6/install/lib/libmoar.so) ==1374== by 0x400F63: main (in /home/dan/Source/perl6/install/bin/moar) ==1374== ==1374== HEAP SUMMARY: ==1374== in use at exit: 49,266,213 bytes in 212,146 blocks ==1374== total heap usage: 227,395 allocs, 15,249 frees, 59,005,691 bytes allocated ==1374== ==1374== LEAK SUMMARY: ==1374== definitely lost: 8,766 bytes in 181 blocks ==1374== indirectly lost: 22,368 bytes in 668 blocks ==1374== possibly lost: 377,160 bytes in 6,738 blocks ==1374== still reachable: 48,857,919 bytes in 204,559 blocks ==1374== suppressed: 0 bytes in 0 blocks ==1374== Rerun with --leak-check=full to see details of leaked memory ==1374== ==1374== For counts of detected and suppressed errors, rerun with: -v ==1374== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
Download (untitled) / with headers
text/plain 212b
The test seems to hang on OSX. So any fix should look into that issue as well. The test is currently commented out in https://github.com/perl6/roast/commit/4f52c6ee10 -- Cheers, ZZ | https://twitter.com/zoffix
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 364b
I've unsuccessfully tried to fix this, but I've come up with an idea how an actual fix might go. When the merge flag (which I added in recent commits) gets passed to MVM_proc_spawn or MVM_proc_shell, we have to first create a new pipe on our own, then set up both stdio 1 and 2 to UV_REUSE_STREAM and set the stdio_container.data.stream to the pipe we've created.
Download (untitled) / with headers
text/plain 105b
Resolved in https://github.com/rakudo/rakudo/commit/c86090e `perl6 -e 'run("ls", :merge).out.slurp.say'`
Download (untitled) / with headers
text/plain 248b
On Wed, 12 Jul 2017 15:30:33 -0700, ugexe@cpan.org wrote: Show quoted text
> Resolved in https://github.com/rakudo/rakudo/commit/c86090e > > `perl6 -e 'run("ls", :merge).out.slurp.say'`
Worls on OSX as well. The fudged test was unfudged by ugexe++. Closing issue.


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

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org