Skip Menu |
Report information
Id: 133162
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: sauvin [at]

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

To: rakudobug [...]
Date: Mon, 30 Apr 2018 00:04:28 -0500
From: Ben Sauvin <sauvin [...]>
Subject: Problem with sample socket code: core dump from malloc failure and memory corruption
Download (untitled) / with headers
text/plain 1.5k
I'm trying to run this code:

my $n;
await IO::Socket::Async.connect('', 5000).then( -> $promise {
    given $promise.result {
        react {
            whenever .Supply(:enc("utf8-c8")).lines -> $v {
#            whenever .Supply() -> $v {
                printf "%d %s\n", ++$n, $v;
#                $v.print;
#                done;
        ## .close;

In my particular case, the input from port 5000 is RAW IRC lines relayed through a socket from a script running under my client; live input. The above program terminates abnormally with the error message after a few thousand lines:

*** Error in `/usr/local/bin/moar': malloc(): memory corruption: 0x00007f133c158840 ***

One of the guys in #perl6 on Freenode reports:

this works for reproducing the leak: yes | pv -L 30m | netcat -l -p 5000

He also reports rapidly increasing memory consumption before the OOM killer gets it, and that even after stopping the 'yes', his line continues producing output. He's suggested this might be a memory leak. Mine was a much longer running experience (usually), with no increase in CPU or MEM as reported by htop, but I *have* noticed that whole batches of lines are printed without line numbers.

I'm running Rakudo Star version 2018.01 built on MoarVM version 2018.01, implementing Perl 6.c, on an Ubuntu 16.04 machine (64-bit) with distro-supplied kernel, libc and libraries, with uname -a:

Linux kubuntu 4.4.0-122-generic #146-Ubuntu SMP Mon Apr 23 15:34:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux.

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

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