fix: fix possible non-termination in ingest_drop().#38
Open
zicklag wants to merge 1 commit into
Open
Conversation
sgwilym
requested changes
Jan 2, 2025
Contributor
sgwilym
left a comment
There was a problem hiding this comment.
Interesting that there were no failing test cases here for so long! As you're right, this FIFO should never end.
Would you be so kind as to make one modification? This kind of stopping pattern is used elsewhere in the codebase, but uses a symbol instead of undefined (e.g.
Thank you!
Author
|
Ah, great idea I'll do that! |
This file contains hidden or 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
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.
Fixes an issue where
ingest_drop()may not terminate.I ran into this issue while adding a way to import drops in earthstar. I'm honestly not sure why the same issue isn't run into in the willow test cases, but I do have a failing test case in a PR to the Earthstar repo.
The issue is that we are pushing chunks into the FIFO and then later here, we are triggering a
for awaitloop that will never end because the FIFO has no concept of an EOF or terminating message.Then a little bit further down the code we are awaiting on the promise running that endless loop, so that we never finish.
This gets around the issue by wrapping the FIFO in a generator that will properly exit when we push an
undefinedto it. That way we can indicate the end of the stream.