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

Be resilient against unexpected end of JSON input #430

Open
mcollina opened this issue Dec 19, 2018 · 8 comments
Open

Be resilient against unexpected end of JSON input #430

mcollina opened this issue Dec 19, 2018 · 8 comments

Comments

@mcollina
Copy link
Contributor

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Parser._flush (/Users/matteo/.nvm/versions/node/v10.14.2/lib/node_modules/clinic/node_modules/@nearform/trace-events-parser/index.js:58:24)
    at Parser.prefinish (_stream_transform.js:141:10)
    at Parser.emit (events.js:182:13)
    at prefinish (_stream_writable.js:630:14)
    at finishMaybe (_stream_writable.js:638:5)
    at endWritable (_stream_writable.js:649:3)
    at Parser.Writable.end (_stream_writable.js:589:5)
    at ReadStream.onend (_stream_readable.js:628:10)
    at Object.onceWrapper (events.js:273:13)
@atistler
Copy link

Same issue here:

node[26906]: ../src/tracing/node_trace_writer.cc:196:void node::tracing::NodeTraceWriter::AfterWrite(): Assertion `(write_req_.result) >= (0)' failed.
 1: 0x10007e9b3 node::Abort() [/Users/adamtistler/.nvm/versions/node/v12.13.1/bin/node]
 2: 0x10007e75b node::AppendExceptionLine(node::Environment*, v8::Local<v8::Value>, v8::Local<v8::Message>, node::ErrorHandlingMode) [/Users/adamtistler/.nvm/versions/node/v12.13.1/bin/node]
 3: 0x10010ad92 node::tracing::NodeTraceWriter::InitializeOnThread(uv_loop_s*)::$_0::__invoke(uv_async_s*) [/Users/adamtistler/.nvm/versions/node/v12.13.1/bin/node]
 4: 0x1008924d2 uv__work_done [/Users/adamtistler/.nvm/versions/node/v12.13.1/bin/node]
 5: 0x100895bc9 uv__async_io [/Users/adamtistler/.nvm/versions/node/v12.13.1/bin/node]
 6: 0x1008a684b uv__io_poll [/Users/adamtistler/.nvm/versions/node/v12.13.1/bin/node]
 7: 0x100896056 uv_run [/Users/adamtistler/.nvm/versions/node/v12.13.1/bin/node]
 8: 0x7fff6a920109 _pthread_start [/usr/lib/system/libsystem_pthread.dylib]
 9: 0x7fff6a91bb8b thread_start [/usr/lib/system/libsystem_pthread.dylib]
process exited by signal SIGABRT
[    ] Analysing dataundefined:1



SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Parser._flush (/Users/adamtistler/.nvm/versions/node/v12.13.1/lib/node_modules/clinic/node_modules/@nearform/trace-events-parser/index.js:58:24)
    at Parser.prefinish (_stream_transform.js:140:10)
    at Parser.emit (events.js:210:5)
    at prefinish (_stream_writable.js:645:14)
    at finishMaybe (_stream_writable.js:653:5)
    at endWritable (_stream_writable.js:673:3)
    at Parser.Writable.end (_stream_writable.js:604:5)
    at ReadStream.onend (_stream_readable.js:692:10)
    at Object.onceWrapper (events.js:299:28)

@RafaelGSS RafaelGSS transferred this issue from clinicjs/node-clinic-bubbleprof Mar 18, 2023
@Stono
Copy link

Stono commented Jun 29, 2023

Same issue here, can't sus this one out!

@Stono
Copy link

Stono commented Jun 29, 2023

So this is caused by having '--trace-events-enabled', '--trace-event-categories', 'v8' where the doctor spawns the process. v18.14.2 btw.

Looks to be nodejs/node#22042?

@Stono
Copy link

Stono commented Jun 29, 2023

OK digging further this only happens in apps for us that include @google-cloud/resource-manager

@Stono
Copy link

Stono commented Jun 29, 2023

Raised: googleapis/google-cloud-node#4384
Not sure of the underlying cause however, hopefully the developers of that library will have a clue which helps others

@Stono
Copy link

Stono commented Jun 29, 2023

Also raised nodejs/node#48598, I think this is the root cause of the bug.

In doctor, it causes a SIGABRT because of this line: https://github.com/clinicjs/node-clinic-doctor/blob/00749d83f04cb30ed24e91f29e89ad25e267ac33/injects/sampler.js#L22

@Stono
Copy link

Stono commented Jun 29, 2023

interestingly this isn't a problem on node16, only 18

@magnusburton
Copy link

interestingly this isn't a problem on node16, only 18

Currently experiencing this on latest versions of 16, 18, 20, and 21.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants