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

Fix a bad race condition that causes intermittent socket receive failures #171

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aggieNick02
Copy link

The issue is caused by the code checking socket status after checking if bytes are available. Bytes may have become available between the last byte available check and the socket status check. This causes us to incorrectly ignore the newly available bytes and return 0 to the caller, which in any blocking/timeout scenario tells the caller no more bytes will ever be available.

This was introduced in commit 89b9f10
See also
#151
as a fix for
#135

failures.

The issue is caused by the code checking socket status *after* checking
if bytes are available. Bytes may have become available between the
last byte available check and the socket status check. This causes us to
incorrectly ignore the newly available bytes and return 0 to the caller,
which in any blocking/timeout scenario tells the caller no more bytes
will ever be available.

This was introduced in commit 89b9f10
See also
adafruit#151
as a fix for
adafruit#135
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