-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[auto/nodejs] - Reimplement JSON event parsing with Readline #7032
Conversation
Don't we still want to fix the issue that is causing malformed event payloads to be received from the CLI? Is that perhaps an issue with needing to flush some buffer before the CLI exits? |
I monkey patched my system with this PR and now I see the following log messages, which reveal that the event's JSON payload is invalid. It looks like there are some bytes missing at the beginning of the JSON payload.
|
@alex-berger thank you for that! that is super helpful. @lukehoban I don't think it's the payload from the CLI that is malformed, but more likely how the file tailer is reading it. In any case, yes that is what we need to fix and @alex-berger's feedback has been super helpful in illuminating the issue. |
I am still struggling to replicate this issue locally. @lukehoban curious to hear why you think this is a CLI-side error. |
@komalali how about logging the full path of the event file on error as well? Then @alex-berger can share the full contents to inform debugging. |
@komalali I think we'll also need to disable the cleanup logic at the time of logging so that the file doesn't get removed. |
934132f
to
bcd3a34
Compare
Okay, I removed split2. I think it was dropping situations where there was an incomplete message in the buffer. Curious to see if this new implementation helps. |
1c12b45
to
b0e8b5a
Compare
Description
A few users have reported a failure when running
Stack.preview()
due to JSON failing to parse. Unfortunately, the error message wasn't really telling us what the actual issue was, but we were able to get some more details by adding debugging logging and getting some help from users.I traced this issue back to the split2 library, where incomplete lines might be dropped. This could happen if the logfile is polled when a message is being written, resulting in a half-formed JSON line. I've replaced it using Readline. I've also added additional error logging in case we see these errors again.
Fixes: #6768
Checklist
This error is difficult to test as it is intermittent, but the existing tests for parsing events continue to succeed. We'll keep an eye on this to see if we see any more reports.