Non-blocking send#160
Open
zuiderkwast wants to merge 3 commits intoEricsson:single-process-clientfrom
Open
Conversation
Use send_timeout 0. If send returns timeout, it has still queued all the data for sending later. When this happens, backoff and don't send more to the socket until the pending commands have got replies from the server. Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
1c0372e to
f261be5
Compare
Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
Collaborator
Author
|
Related discussion about this behavior of the inet driver: |
bjosv
approved these changes
Mar 17, 2026
Collaborator
bjosv
left a comment
There was a problem hiding this comment.
LGTM, seems to be helpful
WilliamVoong
requested changes
Mar 17, 2026
Collaborator
WilliamVoong
left a comment
There was a problem hiding this comment.
Hi i think most of it looks good, just have a small comment in ered_client_tests.erl.
Comment on lines
+262
to
+266
| LargeBinary = (fun Loop(0, Acc) -> | ||
| Acc; | ||
| Loop(I, Acc) -> | ||
| Loop(I - 1, <<Acc/binary, "a">>) | ||
| end)(Size, <<>>), |
Collaborator
There was a problem hiding this comment.
I think its more idiomatic erlang and more readable to write
Suggested change
| LargeBinary = (fun Loop(0, Acc) -> | |
| Acc; | |
| Loop(I, Acc) -> | |
| Loop(I - 1, <<Acc/binary, "a">>) | |
| end)(Size, <<>>), | |
| LargeBinary = binary:copy("a", Size), |
Collaborator
Author
There was a problem hiding this comment.
Thanks! I wasn't aware of binary:copy/2.
Collaborator
Author
|
Some more context. If we use blocking send, the process can become unresponsive and we can get a deadlock. See the discussion here: #157 (comment) |
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.
Use send_timeout 0. If send returns timeout, it has still queued all the data for sending later. When this happens, backoff and don't send more to the socket until the pending commands have got replies from the server.