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

trace_events: not being flushed on SIGINT #18476

Closed
AndreasMadsen opened this issue Jan 31, 2018 · 2 comments
Closed

trace_events: not being flushed on SIGINT #18476

AndreasMadsen opened this issue Jan 31, 2018 · 2 comments
Labels
trace_events Issues and PRs related to V8, Node.js core, and userspace code trace events.

Comments

@AndreasMadsen
Copy link
Member

AndreasMadsen commented Jan 31, 2018

  • Version: master (a025723)
  • Platform: MacOS
  • Subsystem: trace_events

Somehow StopTracingAgent is called in SignalExit() however the tracking file is not properly flushed. I don't understand why, I think it might have some something to do with how SIGINT (by Ctrl+C) affects the process group.

The issue is not that easy to reproduce. However, I can do it consistently with the following steps:

  • run node test.js
  • in another terminal curl http://localhost:3000
  • hit Ctrl+C for on the node test.js process

test.js

const http = require('http')
const { spawn } = require('child_process')

const script = `
const http = require('http')

const server = http.createServer(function (req, res) {
  for (let i = 0; i < 100; i++) {
    process.nextTick(function () {
      res.write('a')
    })
  }

  setImmediate(function () {
    res.end()
  })
})

server.listen(3000, 'localhost')
`

// run program, but inject the sampler
const proc = spawn(process.execPath, ['-e', script], {
  stdio: 'inherit',
  env: Object.assign({}, process.env, {
    NODE_OPTIONS: [
      '--trace-events-enabled', '--trace-event-categories', 'node.async_hooks'
    ].join(' ')
  })
})

process.on('SIGINT', () => proc.kill('SIGINT'))

/cc @ofrobots

@AndreasMadsen AndreasMadsen added the trace_events Issues and PRs related to V8, Node.js core, and userspace code trace events. label Jan 31, 2018
@bnoordhuis
Copy link
Member

Duplicate of #14802. Not easily fixable.

@bnoordhuis
Copy link
Member

We're over 600 open issues right now so I'll go ahead and close this out as a duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

2 participants