network-audit is terminated before logs finish writing
See original GitHub issueDescription
While investigating parsing errors for network-audit and during code review w/ @bridiver (for a band-aid patch I had), it became clear that we need to wait until the logs are written out in their entirety to ensure integrity of the network-audit
SIGTERM
/ SIGKILL
were added with https://github.com/brave/brave-browser/pull/4036 which may have introduced the problem. Because the stream for the logger isn’t flushed, there are missing line endings. The first band-aid patch was done for this with https://github.com/brave/brave-browser/pull/2787
Steps to Reproduce
- Run
npm run network-audit
on the platform of your choice - Open
network_log.json
in a text editor
Actual result:
Notice how this is likely not proper JSON. It’s missing the ]
to close events: [
and then the closing }
tag for the entire JSON blob (possibly missing more).
Expected result:
Log should be valid JSON; no “hack” should be needed to parse the file. There might be missing entries- the process needs to complete the log on its own.
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (6 by maintainers)
Top GitHub Comments
cc: @mariospr
@diracdeltas that’s definitely one approach; another which @bridiver proposed would be to create a new test suite, something like
npm run test brave_network_audit
which could wait a predetermined amount of time (or possibly run navigation tests) and then logs would be checked as a final part of the test