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

Segfault when spawning child with trace events enabled #22042

Closed
kamil-mech opened this issue Jul 31, 2018 · 2 comments
Closed

Segfault when spawning child with trace events enabled #22042

kamil-mech opened this issue Jul 31, 2018 · 2 comments
Assignees
Labels
confirmed-bug Issues with confirmed bugs. trace_events Issues and PRs related to V8, Node.js core, and userspace code trace events.

Comments

@kamil-mech
Copy link

Introduced in version 10.2.0 (found in versions 10.2.0..10.7.0)

Tiny snippet:

'use strict'

const { spawn } = require('child_process')

// Spawning a child with trace events enabled
// Segfaults when:
// - Destination file is missing OR
// - On any error thrown inside the file, like `throw new Error('foo')` or `require('module-not-found')`
const proc = spawn('node', ['non-existent.js'], {
  env: Object.assign({}, process.env, {
    NODE_OPTIONS: '--trace-events-enabled'
  })
})

proc.once('exit', function (code, signal) {
  console.log({ code, signal })
})

Execution:

km-mac:n-tmp km$ nvm use 10.7
Now using node v10.7.0 (npm v6.1.0)
km-mac:n-tmp km$ node segfault-issue.js
{ code: null, signal: 'SIGSEGV' }
# BROKEN

km-mac:n-tmp km$ nvm use 10.2
Now using node v10.2.0 (npm v5.6.0)
km-mac:n-tmp km$ node segfault-issue.js
{ code: null, signal: 'SIGSEGV' }
# BROKEN

km-mac:n-tmp km$ nvm use 10.1
Now using node v10.1.0 (npm v5.6.0)
km-mac:n-tmp km$ node segfault-issue.js
{ code: 1, signal: null }
# OK

km-mac:n-tmp km$ nvm use 10.2
Now using node v10.2.0 (npm v5.6.0)

km-mac:n-tmp km$ echo "throw new Error('foo')" > non-existent.js
km-mac:n-tmp km$ node segfault-issue.js
{ code: null, signal: 'SIGSEGV' }
# On error throw

km-mac:n-tmp km$ echo "require('foo')" > non-existent.js
km-mac:n-tmp km$ node segfault-issue.js
{ code: null, signal: 'SIGSEGV' }
# On ENOENT require

km-mac:n-tmp km$ echo "require('http')" > non-existent.js
km-mac:n-tmp km$ node segfault-issue.js
{ code: 0, signal: null }
# When contents are valid

km-mac:n-tmp km$ ls
node_trace.1.log	non-existent.js		segfault-issue.js
# Trace log was produced during one of these executions

Trace log file:
node_trace.1.log

OSX El Capitan 10.11.6

km-mac:n-tmp km$ uname -a
Darwin km-mac.local 15.6.0 Darwin Kernel Version 15.6.0: Thu Jun 21 20:07:40 PDT 2018; root:xnu-3248.73.11~1/RELEASE_X86_64 x86_64
@BridgeAR BridgeAR added confirmed-bug Issues with confirmed bugs. trace_events Issues and PRs related to V8, Node.js core, and userspace code trace events. labels Jul 31, 2018
@BridgeAR
Copy link
Member

Ping @nodejs/trace-events

@addaleax
Copy link
Member

This would be addressed by #21867 … I’ll try to get through with that one this week :/

@addaleax addaleax self-assigned this Aug 1, 2018
targos pushed a commit that referenced this issue Aug 1, 2018
Fixes: #22042

PR-URL: #21867
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Eugene Ostroukhov <[email protected]>
Reviewed-By: Ali Ijaz Sheikh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. trace_events Issues and PRs related to V8, Node.js core, and userspace code trace events.
Projects
None yet
Development

No branches or pull requests

3 participants