conn: robustly deliver response after channel read EOF #892
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.
It is presently impossible to interface with conn using the typical pattern of sending a command using one program, and receiving the result with another through Unix pipes. Conn will eagerly close the connection as soon as it hears EOF from the read end of the pipe, which does not leave any chance to deliver an future result to the recipient. The only way to reliably receive results from conn in this situation is to set long timeouts in tools such as
netcatorsocat.This PR is (1) request for clarification about the protocol, whether the original behavior was intended, and (2) a first attempt to rectify this situation by:
newt.cThis PR requires an expert's look whether this change fits well with other IO drivers, given that
newt.cis used in many other places.With this PR applied, I have been able to successfully use
socatwith theclickscript to dramatically speedup interactions with an Urbit ship via conn.Our backend tests runner now completes in under
20s, while previously it took more than 4m to complete, due to a need for long timeouts at each interaction.