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

malloc(): memory corruption Aborted (core dumped) #2403

Open
zoffixznet opened this issue Oct 20, 2018 · 6 comments
Open

malloc(): memory corruption Aborted (core dumped) #2403

zoffixznet opened this issue Oct 20, 2018 · 6 comments
Labels
SEGV Segmentation fault, bus error, etc.

Comments

@zoffixznet
Copy link
Contributor

Moved from Raku/doc#2398

$ perl6 -v
This is Rakudo version 2018.06 built on MoarVM version 2018.06 implementing Perl 6.c.

$ rpm -qa rakudo\* 
rakudo-pkg-2018.06-01.x86_64

sub RunNoShellAll( Str $RunString, Int $StdOut, Int $StdErr, Int $Code --> List )
malloc(): memory corruption Aborted (core dumped)

sub RunNoShellAll( Str $RunString, Int $StdOut, Int $StdErr, Int $Code, --> List )
free(): invalid next size (fast) Aborted (core dumped)

Removing --> List completely restored functionality

The rest of the sub:

sub RunNoShellAll( Str $RunString, Int $StdOut, Int $StdErr, Int $Code ) {
   # returns  
   #    StdOut as Str $ReturnStr
   #    StdErr as Str $ReturnErr
   #    Return Code ($?) as Int $RtnCode

   # $RunString   Comnad line to run without a shell
   # $StdOur      read and return the STDOUT       1=yes, 0=no
   # $StdErr      read and return the STDERR       1=yes, 0=no    
   # $Code        read and return the return code  1=yes, 0=no 
  
   # Note: If reading the STDERR, it is PRESUMED you also will be reading the STDIN.
   #       If only reading the return code, it is presumed that you want the STDERR
   #          and STDIN to be silent.
  
   # place each value into a cell in an array.  Keep quoted 
   # values together
   # print "Run String = <$RunString>\n";
   
    
   my Buf $BufStdErr; 
   my Str $ReturnStr = ""; 
   my Str $ReturnErr = "";
   my Int $RtnCode = 0;
   my $proc;
   
   my @RunArray  = $RunString ~~ m:global/ [ '"' <-[ " ]> * '"' | \S+ ] /;
   
   # shells remove the quote, so you have to here as well
   for @RunArray.kv -> $index, $value { @RunArray[$index] ~~ s:g/\"//; };
   # for @RunArray.kv -> $index, $value { say "\$RunArray[$index] = <$value>"; }; print "\n";
   
   if    $StdErr  { $proc      = run( @RunArray, :err, :out, :enc<utf8-c8> ); }  
   elsif $StdOut  { $proc      = run( @RunArray,       :out, :enc<utf8-c8> ); }  # STDERR goes to the terminal
   else           { $proc      = run( @RunArray, :err, :out, :enc<utf8-c8> ); }  # STDIN and STDERR are silent
   
   if  $Code    { $RtnCode   = $proc.status; } 
   if  $StdErr  { $ReturnErr = $proc.err.slurp; }
   if  $StdOut  { $ReturnStr = $proc.out.slurp; } 
   
   return( $ReturnStr, $ReturnErr, $RtnCode );
}
@ToddAndMargo
Copy link

I hate to say this, but this is intermittent. Some times it does and sometimes it doesn't.

Is there a core dump somewhere after this error happens I could attach?

@zoffixznet
Copy link
Contributor Author

We need a runnable program we can run to reproduce the error, regardless of whether it's intermittent or not.

@ToddAndMargo
Copy link

ToddAndMargo commented Oct 20, 2018

Requires Fedora 28 or similar

RunNoShellTest.pl6
http://vpaste.net/JnhDP

RunNoShell.pm6
This works
http://vpaste.net/UgZDB

This is the problem one:
http://vpaste.net/kd3SA

@ToddAndMargo
Copy link

how about my question as to the core dumps?

@AlexDaniel AlexDaniel added the SEGV Segmentation fault, bus error, etc. label Oct 20, 2018
Kaiepi added a commit to Kaiepi/rakudo that referenced this issue Oct 20, 2018
@MasterDuke17
Copy link
Contributor

@Kaiepi did you create a PR with your fix?

@Kaiepi
Copy link
Contributor

Kaiepi commented Nov 25, 2018

No, that was a typo in the commit I made

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

5 participants