-
Notifications
You must be signed in to change notification settings - Fork 377
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
refactor: Clean up internals of the logstreams #897
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jaqx0r
force-pushed
the
logstream-refactors
branch
from
July 12, 2024 11:04
aba5e89
to
9716443
Compare
Unit Test Results 1 files 27 suites 8m 41s ⏱️ Results for commit 47e973f. ♻️ This comment has been updated with latest results. |
This makes all the log invocations identical as well as we don't need to construct a name for dgram and socket streams.
Remove the lastReadTime as we don't use it.
These are noisy and hard to read.
According to `pipe(7)` and `read(2)` the read will return 0 when all writer FDs are closed, with no `errno`, signalling EOF. In order to use the `io.ReadFrom` interface we won't be able to rely on the return of `io.EOF` anymore.
jaqx0r
force-pushed
the
logstream-refactors
branch
2 times, most recently
from
July 12, 2024 12:24
22703eb
to
cde3caf
Compare
When opening a fifo in nonblocking mode to allow for delays in the writer, we also turn the Read into a nonblocking read. This is desirable for context cancellation but makes the Read return before bytes may be ready. `pipe(7)` and `read(2)` POSIX manpages tell us that if there are no writers connected, `read` will return end-of-file. In Go, this means we get a (0, EOF) pair. We shouldn't necessarily exit straight away though, because the writer may not have started writing yet. In test this is visible as race conditions when the `Read` is scheduled before the test performs a `Write`. We can decide that a stream is active once a single byte has been read, and only allow EOF to trigger shutdown on an active stream. Thus we check here for `total > 0` for 0 byte and EOF err responses on `Read` before exiting the stream. This fixes known races in `pipestream` so far.
jaqx0r
force-pushed
the
logstream-refactors
branch
from
July 12, 2024 13:27
cde3caf
to
2e17520
Compare
This keeps confusing me, but we're reading unix named pipes aka fifos, not pipes.
jaqx0r
force-pushed
the
logstream-refactors
branch
from
July 12, 2024 13:34
1fbd4b3
to
47e973f
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: #199