Skip to content

Instantly share code, notes, and snippets.

@MasterDuke17
Last active December 3, 2016 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MasterDuke17/8e1628d62ac4e77e0cb52ac3ffd6ccde to your computer and use it in GitHub Desktop.
Save MasterDuke17/8e1628d62ac4e77e0cb52ac3ffd6ccde to your computer and use it in GitHub Desktop.
segv from golfable
bisectable@superserver:~/git/whateverable$ valgrind --trace-children=yes /home/bisectable/.rakudobrew/moar-nom/install/bin/moar --full-cleanup --execname=/home/bisectable/.rakudobrew/bin/../moar-nom/install/bin/perl6-valgrind-m --libpath=/home/bisectable/.rakudobrew/moar-nom/install/share/nqp/lib --libpath=/home/bisectable/.rakudobrew/moar-nom/install/share/perl6/lib --libpath=/home/bisectable/.rakudobrew/moar-nom/install/share/perl6/runtime /home/bisectable/.rakudobrew/moar-nom/install/share/perl6/runtime/perl6.moarvm Golfable.p6
==6528== Memcheck, a memory error detector
==6528== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==6528== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==6528== Command: /home/bisectable/.rakudobrew/moar-nom/install/bin/moar --full-cleanup --execname=/home/bisectable/.rakudobrew/bin/../moar-nom/install/bin/perl6-valgrind-m --libpath=/home/bisectable/.rakudobrew/moar-nom/install/share/nqp/lib --libpath=/home/bisectable/.rakudobrew/moar-nom/install/share/perl6/lib --libpath=/home/bisectable/.rakudobrew/moar-nom/install/share/perl6/runtime /home/bisectable/.rakudobrew/moar-nom/install/share/perl6/runtime/perl6.moarvm Golfable.p6
==6528==
==6538== Memcheck, a memory error detector
==6538== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==6538== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==6538== Command: /home/bisectable/.rakudobrew/bin/perl6 -e .say\ for\ 0..0x1FFFF
==6538==
==6538== Memcheck, a memory error detector
==6538== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==6538== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==6538== Command: /usr/bin/perl /home/bisectable/.rakudobrew/bin/perl6 -e .say\ for\ 0..0x1FFFF
==6538==
==6538== Memcheck, a memory error detector
==6538== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==6538== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==6538== Command: /home/bisectable/.rakudobrew/bin/../moar-nom/install/bin/perl6 -e .say\ for\ 0..0x1FFFF
==6538==
==6538== Memcheck, a memory error detector
==6538== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==6538== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==6538== Command: /home/bisectable/.rakudobrew/moar-nom/install/bin/moar --execname=/home/bisectable/.rakudobrew/bin/../moar-nom/install/bin/perl6 --libpath=/home/bisectable/.rakudobrew/moar-nom/install/share/nqp/lib --libpath=/home/bisectable/.rakudobrew/moar-nom/install/share/perl6/lib --libpath=/home/bisectable/.rakudobrew/moar-nom/install/share/perl6/runtime /home/bisectable/.rakudobrew/moar-nom/install/share/perl6/runtime/perl6.moarvm -e .say\ for\ 0..0x1FFFF
==6538==
Unhandled exception in code scheduled on thread 3
244687
Cannot send a message on a closed channel
in block at Golfable.p6 line 6
in any at /home/bisectable/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm line 1
in sub THROW at /home/bisectable/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm line 1
in block at /home/bisectable/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm line 1
Cannot send a message on a closed channel
in block at Golfable.p6 line 6
in any at /home/bisectable/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm line 1
in sub THROW at /home/bisectable/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm line 1
in block at /home/bisectable/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm line 1
==6528== Thread 2:
==6528== Invalid read of size 8
==6528== at 0x50777DD: uv__write (in /home/bisectable/.rakudobrew/moar-nom/install/lib/libmoar.so)
==6528== by 0x5078A77: uv_write2 (in /home/bisectable/.rakudobrew/moar-nom/install/lib/libmoar.so)
==6528== by 0x4FCF604: MVM_io_syncstream_write_str (syncstream.c:200)
==6528== by 0x4FCD4A1: MVM_io_write_string (io.c:214)
==6528== by 0x4F96899: MVM_interp_run (interp.c:3488)
==6528== by 0x4FB63BD: start_thread (threads.c:77)
==6528== by 0x50795F6: uv__thread_start (in /home/bisectable/.rakudobrew/moar-nom/install/lib/libmoar.so)
==6528== by 0x5B6E0A3: start_thread (pthread_create.c:309)
==6528== Address 0xa20a1f0 is 112 bytes inside a block of size 192 free'd
==6528== at 0x4C29E90: free (vg_replace_malloc.c:473)
==6528== by 0x50776A0: uv__write_callbacks (in /home/bisectable/.rakudobrew/moar-nom/install/lib/libmoar.so)
==6528== by 0x5078250: uv__stream_io (in /home/bisectable/.rakudobrew/moar-nom/install/lib/libmoar.so)
==6528== by 0x5070712: uv_run (in /home/bisectable/.rakudobrew/moar-nom/install/lib/libmoar.so)
==6528== by 0x4FCF614: MVM_io_syncstream_write_str (syncstream.c:207)
==6528== by 0x4FCD4A1: MVM_io_write_string (io.c:214)
==6528== by 0x4F96899: MVM_interp_run (interp.c:3488)
==6528== by 0x505B148: MVM_vm_run_file (moar.c:309)
==6528== by 0x400FDE: main (main.c:191)
==6528==
==6528== Invalid read of size 4
==6528== at 0x50777E1: uv__write (in /home/bisectable/.rakudobrew/moar-nom/install/lib/libmoar.so)
==6528== by 0x5078A77: uv_write2 (in /home/bisectable/.rakudobrew/moar-nom/install/lib/libmoar.so)
==6528== by 0x4FCF604: MVM_io_syncstream_write_str (syncstream.c:200)
==6528== by 0x4FCD4A1: MVM_io_write_string (io.c:214)
==6528== by 0x4F96899: MVM_interp_run (interp.c:3488)
==6528== by 0x4FB63BD: start_thread (threads.c:77)
==6528== by 0x50795F6: uv__thread_start (in /home/bisectable/.rakudobrew/moar-nom/install/lib/libmoar.so)
==6528== by 0x5B6E0A3: start_thread (pthread_create.c:309)
==6528== Address 0xa20a1e8 is 104 bytes inside a block of size 192 free'd
==6528== at 0x4C29E90: free (vg_replace_malloc.c:473)
==6528== by 0x50776A0: uv__write_callbacks (in /home/bisectable/.rakudobrew/moar-nom/install/lib/libmoar.so)
==6528== by 0x5078250: uv__stream_io (in /home/bisectable/.rakudobrew/moar-nom/install/lib/libmoar.so)
==6528== by 0x5070712: uv_run (in /home/bisectable/.rakudobrew/moar-nom/install/lib/libmoar.so)
==6528== by 0x4FCF614: MVM_io_syncstream_write_str (syncstream.c:207)
==6528== by 0x4FCD4A1: MVM_io_write_string (io.c:214)
==6528== by 0x4F96899: MVM_interp_run (interp.c:3488)
==6528== by 0x505B148: MVM_vm_run_file (moar.c:309)
==6528== by 0x400FDE: main (main.c:191)
==6528==
==6528== Invalid read of size 8
==6528== at 0x50777F9: uv__write (in /home/bisectable/.rakudobrew/moar-nom/install/lib/libmoar.so)
==6528== by 0x5078A77: uv_write2 (in /home/bisectable/.rakudobrew/moar-nom/install/lib/libmoar.so)
==6528== by 0x4FCF604: MVM_io_syncstream_write_str (syncstream.c:200)
==6528== by 0x4FCD4A1: MVM_io_write_string (io.c:214)
==6528== by 0x4F96899: MVM_interp_run (interp.c:3488)
==6528== by 0x4FB63BD: start_thread (threads.c:77)
==6528== by 0x50795F6: uv__thread_start (in /home/bisectable/.rakudobrew/moar-nom/install/lib/libmoar.so)
==6528== by 0x5B6E0A3: start_thread (pthread_create.c:309)
==6528== Address 0x18 is not stack'd, malloc'd or (recently) free'd
==6528==
==6528==
==6528== Process terminating with default action of signal 11 (SIGSEGV)
==6528== Access not within mapped region at address 0x18
==6528== at 0x50777F9: uv__write (in /home/bisectable/.rakudobrew/moar-nom/install/lib/libmoar.so)
==6528== by 0x5078A77: uv_write2 (in /home/bisectable/.rakudobrew/moar-nom/install/lib/libmoar.so)
==6528== by 0x4FCF604: MVM_io_syncstream_write_str (syncstream.c:200)
==6528== by 0x4FCD4A1: MVM_io_write_string (io.c:214)
==6528== by 0x4F96899: MVM_interp_run (interp.c:3488)
==6528== by 0x4FB63BD: start_thread (threads.c:77)
==6528== by 0x50795F6: uv__thread_start (in /home/bisectable/.rakudobrew/moar-nom/install/lib/libmoar.so)
==6528== by 0x5B6E0A3: start_thread (pthread_create.c:309)
==6528== If you believe this happened as a result of a stack
==6528== overflow in your program's main thread (unlikely but
==6528== possible), you can try to increase the size of the
==6528== main thread stack using the --main-stacksize= flag.
==6528== The main thread stack size used in this run was 8388608.
==6528==
==6528== HEAP SUMMARY:
==6528== in use at exit: 105,128,113 bytes in 191,689 blocks
==6528== total heap usage: 327,894 allocs, 136,205 frees, 348,219,799 bytes allocated
==6528==
==6528== LEAK SUMMARY:
==6528== definitely lost: 9,018 bytes in 246 blocks
==6528== indirectly lost: 22,260 bytes in 668 blocks
==6528== possibly lost: 393,984 bytes in 7,023 blocks
==6528== still reachable: 104,702,851 bytes in 183,752 blocks
==6528== suppressed: 0 bytes in 0 blocks
==6528== Rerun with --leak-check=full to see details of leaked memory
==6528==
==6528== For counts of detected and suppressed errors, rerun with: -v
==6528== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)
#!/usr/bin/env perl6
sub get-output(*@run-args, :$timeout = 10, :$stdin) {
my $out = Channel.new; # TODO switch to some Proc :merge thing once it is implemented
my $proc = Proc::Async.new(|@run-args, :w(defined $stdin));
$proc.stdout.tap(-> $v { $out.send: $v });
$proc.stderr.tap(-> $v { $out.send: $v });
my $s-start = now;
my $promise = $proc.start;
if defined $stdin {
$proc.print: $stdin;
$proc.close-stdin;
}
await Promise.anyof(Promise.in($timeout), $promise);
my $s-end = now;
if not $promise.status ~~ Kept { # timed out
$proc.kill; # TODO sends HUP, but should kill the process tree instead
$out.send: “«timed out after $timeout seconds, output»: ”;
}
$out.close;
return $out.list.join.chomp, $promise.result.exitcode, $promise.result.signal, $s-end - $s-start
}
my @args = get-output(‘perl6’, ‘-e’, ‘say join “\c[31]”, (0..0x1FFFF).grep: { say ‘a’ }’);
say @args[0].chars;
my @args2 = get-output(‘perl6’, ‘-e’, ‘say join “\c[31]”, (0..0x1FFFF).grep: { say ‘a’ }’);
say @args2[0].chars;
my @args3 = get-output(‘perl6’, ‘-e’, ‘say join “\c[31]”, (0..0x1FFFF).grep: { say ‘a’ }’);
say @args3[0].chars;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment