GeezerVison is showing github.com — Segfault when spawning child with trace events enabled · Issue #22042 · nodejs/node
Segfault when spawning child with trace events enabled #22042Labels confirmed-bugIssues and PRs for confirmed bugs.trace_eventsIssues and PRs related to trace events from V8, Node.js core, and user code. DescriptionIntroduced 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
ActivityBridgeAR commented on Jul 31, 2018 Ping @nodejs/trace-events addaleax commented on Jul 31, 2018 This would be addressed by #21867 … I’ll try to get through with that one this week :/ Reacted by Kamil Mech, Matteo Collina, James M Snell and GP
MetadataMetadataconfirmed-bugIssues and PRs for confirmed bugs.trace_eventsIssues and PRs related to trace events from V8, Node.js core, and user code. DevelopmentNo branches or pull requestsIssue actions
|