https://bugs.kde.org/show_bug.cgi?id=393415

            Bug ID: 393415
           Summary: Valgrind memory debugging for nodejs using child
                    process failed on MacOS
           Product: valgrind
           Version: 3.14 SVN
          Platform: Compiled Sources
                OS: OS X
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: memcheck
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

I am trying to debug a nodejs script which has dependencies on native bindings.
That script also involves forking a child process. I am using valgrind to debug
the memory issues with following options:

```
valgrind --leak-check=summary --show-leak-kinds=all --trace-children=yes
--verbose  node app.js
```

It only works if I set `--trace-children=no`, otherwise always failed.

I created following sample script to test the scenario and it seems valgrind
does not work debugging child process running in node.


```
// main.js
var cp = require('child_process');
var child = cp.fork('./worker');

child.on('message', function(m) {
  // Receive results from child process
  console.log('received: ' + m);
});

// Send child process some work
child.send('Please up-case this string');
```

and 

```
worker.js
process.on('message', function(m) {
  // Do work  (in this case just up-case the string
  m = m.toUpperCase();

  // Pass results back to parent process
  process.send(m.toUpperCase(m));
});
```


And `valgrind` always failed with following error:

```
==10401== execve(0x1048a3150(/bin/bash), 0x1048a3638, 0x1048a3658) failed,
errno 2
==10401== EXEC FAILED: I can't recover from execve() failing, so I'm dying.
==10401== Add more stringent tests in PRE(sys_execve), or work out how to
recover.
```


This happens only on MacOS, I tried it on Ubuntu and its working fine.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to