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

MAX_WRITE can cause messages to split #96

Closed
ronag opened this issue Aug 25, 2021 · 1 comment · Fixed by #102
Closed

MAX_WRITE can cause messages to split #96

ronag opened this issue Aug 25, 2021 · 1 comment · Fixed by #102

Comments

@ronag
Copy link
Contributor

ronag commented Aug 25, 2021

Due to MAX_WRITE a call to write is not guaranteed to be atomic, i.e. it can be split into multiple writes. This in combination with child processes can cause the parent process to interleave incomplete messages from different child processes.

I believe this should be possible to resolve by checking against MAX_WRITE before appending to this._buf.

Refs: pinojs/pino#1098

@mcollina
Copy link
Member

PR with tests?

ronag added a commit to ronag/sonic-boom that referenced this issue Aug 26, 2021
ronag added a commit to ronag/sonic-boom that referenced this issue Aug 26, 2021
ronag added a commit to ronag/sonic-boom that referenced this issue Aug 26, 2021
ronag added a commit to ronag/sonic-boom that referenced this issue Aug 26, 2021
ronag added a commit to ronag/sonic-boom that referenced this issue Aug 26, 2021
mcollina added a commit that referenced this issue Aug 27, 2021
* fix: ensure writes are always atomic

Fixes: #96

* fixup

* fixup

* fixup

* fixup

* fixup

* fixup

* fixup

* fixup

* fixup

* fixup

* Added test for large async atomic writes

* Performance improvements

* typo

Co-authored-by: Robert Nagy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants