node-clinic: premature close error on process exit

Expected Behavior

An HTML report should be saved

Current Behavior

Doctor, bubbleprof, and flame all crash with this error:

Error: premature close
    at MultiStream.onclose (/Users/contra/.nvm/versions/node/v10.6.0/lib/node_modules/clinic/node_modules/end-of-stream/index.js:47:67)
    at MultiStream.emit (events.js:187:15)
    at MultiStream.destroy (/Users/contra/.nvm/versions/node/v10.6.0/lib/node_modules/clinic/node_modules/multistream/index.js:65:8)
    at DestroyableTransform.onClose (/Users/contra/.nvm/versions/node/v10.6.0/lib/node_modules/clinic/node_modules/multistream/index.js:111:12)
    at Object.onceWrapper (events.js:273:13)
    at DestroyableTransform.emit (events.js:187:15)
    at /Users/contra/.nvm/versions/node/v10.6.0/lib/node_modules/clinic/node_modules/through2/through2.js:20:10
    at process._tickCallback (internal/process/next_tick.js:61:11)

Steps to Reproduce (for bugs)

  1. Node 10.6
  2. npm install clinic -g
  3. clinic doctor -- node dummy-server.js
  4. Wait a bit, press CTRL-C

Environment

  • Clinic version: Clinic v1.1.0 Doctor v3.0.3
  • Node version: v10.6
  • Operating system and version: MacOS Mojave Beta

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 4
  • Comments: 32 (12 by maintainers)

Most upvoted comments

Same here. I’m using node v12.13.0.

Analysing dataError: premature close
    at onclosenexttick (/usr/lib/node_modules/clinic/node_modules/end-of-stream/index.js:53:86)
    at processTicksAndRejections (internal/process/task_queues.js:75:11)

Steps to repro:

  1. Generate Moleculer demo project
  2. Open the generated project, set transporter to null in moleculer.config.js
  3. Run clinic doctor -- npm run dev
  4. Run autocannon http://localhost:3000/api/greeter/hello
  5. Press Ctrl + C

When it happens, I recommend you to:

  • Remove the .clinic folder
  • Remove all the node_trace.*.log files
  • If you are running the autocannon for a small period of time, increase it.

@jasnell, the thing is, I can run much larger profiles with no problems if I hack end-of-stream with that https://github.com/mafintosh/end-of-stream/pull/13 fix.

@goto-bus-stop @DylanC … let’s make sure this issue is looked at for the next release.

I’m also having it on node 10.16.3. The fix described in https://github.com/mafintosh/end-of-stream/pull/13 fixes it completely.

I’m also running clinic doctor locally and having the same issue. I am running 6 request per second for 5 minutes (total of 1800 requests) Using clinic v4.2.0