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

refactor: Clean up internals of the logstreams #897

Merged
merged 13 commits into from
Jul 12, 2024
Merged

Conversation

jaqx0r
Copy link
Contributor

@jaqx0r jaqx0r commented Jul 12, 2024

Issue: #199

@jaqx0r jaqx0r force-pushed the logstream-refactors branch from aba5e89 to 9716443 Compare July 12, 2024 11:04
Copy link
Contributor

github-actions bot commented Jul 12, 2024

Unit Test Results

    1 files     27 suites   8m 41s ⏱️
  648 tests   647 ✅ 1 💤 0 ❌
1 917 runs  1 914 ✅ 3 💤 0 ❌

Results for commit 47e973f.

♻️ This comment has been updated with latest results.

@jaqx0r jaqx0r force-pushed the logstream-refactors branch 2 times, most recently from 22703eb to cde3caf Compare July 12, 2024 12:24
github-actions[bot]
github-actions bot previously approved these changes Jul 12, 2024
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.
github-actions[bot]
github-actions bot previously approved these changes Jul 12, 2024
This keeps confusing me, but we're reading unix named pipes aka fifos, not pipes.
@jaqx0r jaqx0r added this pull request to the merge queue Jul 12, 2024
Merged via the queue into main with commit 0494356 Jul 12, 2024
23 checks passed
@jaqx0r jaqx0r deleted the logstream-refactors branch July 12, 2024 14:12
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 this pull request may close these issues.

1 participant