clinicjs / node-clinic

Clinic.js diagnoses your Node.js performance issues
https://clinicjs.org
MIT License
5.68k stars 125 forks source link

decoded message is not valid #427

Open mcollina opened 5 years ago

mcollina commented 5 years ago

I'm getting a:

  if (!(end <= buf.length && offset <= buf.length)) throw new Error("Decoded message is not valid")
                                                    ^

Error: Decoded message is not valid
    at Object.decode (eval at line.toFunction (/Users/matteo/.nvm/versions/node/v10.14.0/lib/node_modules/clinic/node_modules/generate-function/index.js:172:21), <anonymous>:6:59)
    at Object.decode (eval at line.toFunction (/Users/matteo/.nvm/versions/node/v10.14.0/lib/node_modules/clinic/node_modules/generate-function/index.js:172:21), <anonymous>:31:30)
    at StackTraceDecoder._transform (/Users/matteo/.nvm/versions/node/v10.14.0/lib/node_modules/clinic/node_modules/@nearform/bubbleprof/format/abstract-decoder.js:42:31)
    at StackTraceDecoder.Transform._read (_stream_transform.js:190:10)
    at StackTraceDecoder.Transform._write (_stream_transform.js:178:12)
    at doWrite (_stream_writable.js:410:12)
    at writeOrBuffer (_stream_writable.js:394:5)
    at StackTraceDecoder.Writable.write (_stream_writable.js:294:11)
    at ReadStream.ondata (_stream_readable.js:666:20)
    at ReadStream.emit (events.js:182:13)

on a huge profile.

I think this might be due to truncation.

Overall we should try not to crash in these situation, but display a warning and try to continue.

msalafia commented 8 months ago

@mcollina Any update on this? i am trying to use clinic.js on a Node.js application using Piscina (so worker_threads) but whe i enter CTRL+C i receive your same error.

franher commented 3 weeks ago

@mcollina Any update on this? i am trying to use clinic.js on a Node.js application using Piscina (so worker_threads) but whe i enter CTRL+C i receive your same error.

Unfortunately, I have the same issue. As soon as I added piscina and workers_threads, the exception occurs when closing the server execution analyzed by doctor.

if (!found0 || !found1 || !found2 || !found3 || !found4) throw new Error("Decoded message is not valid")
                                                               ^

Error: Decoded message is not valid
    at Object.decode (eval at line.toFunction (/Users/fherrero/Library/Application Support/fnm/node-versions/v20.14.0/installation/lib/node_modules/clinic/node_modules/generate-function/index.js:172:21), <anonymous>:23:70)
    at ProcessStatDecoder._transform (/Users/fherrero/Library/Application Support/fnm/node-versions/v20.14.0/installation/lib/node_modules/clinic/node_modules/@clinic/doctor/format/abstract-decoder.js:42:31)
    at Transform._write (node:internal/streams/transform:171:8)
    at writeOrBuffer (node:internal/streams/writable:564:12)
    at _write (node:internal/streams/writable:493:10)
    at Writable.write (node:internal/streams/writable:502:10)
    at ReadStream.ondata (node:internal/streams/readable:1007:22)
    at ReadStream.emit (node:events:519:28)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
simoneb commented 3 weeks ago

@franher please sse the note in README https://github.com/clinicjs/node-clinic?tab=readme-ov-file#clinicjs