Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attempting to use :merge when run()ning an external command causes a core dump #5443

Closed
p6rt opened this issue Jul 10, 2016 · 11 comments
Closed
Labels
SEGV Segmentation fault, bus error, etc.

Comments

@p6rt
Copy link

p6rt commented Jul 10, 2016

Migrated from rt.perl.org#128594 (status was 'resolved')

Searchable as RT128594$

@p6rt
Copy link
Author

p6rt commented Aug 5, 2015

From @hoelzro

See the attached script.

@p6rt
Copy link
Author

p6rt commented Aug 5, 2015

From @hoelzro

test.pl

@p6rt
Copy link
Author

p6rt commented Jan 15, 2016

From @autarch

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.

@p6rt
Copy link
Author

p6rt commented Jul 10, 2016

From @MasterDuke17

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)

@p6rt
Copy link
Author

p6rt commented Jul 13, 2016

From @zoffixznet

Fudged tests added​: Raku/roast@a8afed7259

@p6rt
Copy link
Author

p6rt commented Jul 13, 2016

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jul 13, 2016

From @zoffixznet

The test seems to hang on OSX. So any fix should look into that issue as well.

The test is currently commented out in Raku/roast@4f52c6ee10

--
Cheers,
ZZ | https://twitter.com/zoffix

@p6rt
Copy link
Author

p6rt commented Jul 31, 2016

From @timo

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.

@p6rt
Copy link
Author

p6rt commented Jul 12, 2017

From @ugexe

Resolved in rakudo/rakudo@c86090e

`perl6 -e 'run("ls", :merge).out.slurp.say'`

@p6rt
Copy link
Author

p6rt commented Jul 13, 2017

From @dogbert17

On Wed, 12 Jul 2017 15​:30​:33 -0700, ugexe@​cpan.org wrote​:

Resolved in rakudo/rakudo@c86090e

`perl6 -e 'run("ls", :merge).out.slurp.say'`

Worls on OSX as well. The fudged test was unfudged by ugexe++. Closing issue.

@p6rt
Copy link
Author

p6rt commented Jul 13, 2017

@dogbert17 - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Jul 13, 2017
@p6rt p6rt added the SEGV Segmentation fault, bus error, etc. label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SEGV Segmentation fault, bus error, etc.
Projects
None yet
Development

No branches or pull requests

1 participant