Skip to content

io BUGFIX do not fail when there is data left to read#229

Merged
michalvasko merged 1 commit intoCESNET:develfrom
6WIND:io-pollup
May 15, 2020
Merged

io BUGFIX do not fail when there is data left to read#229
michalvasko merged 1 commit intoCESNET:develfrom
6WIND:io-pollup

Conversation

@rjarry
Copy link
Copy Markdown
Contributor

@rjarry rjarry commented May 15, 2020

When using the UNIX transport and depending on the timing between the server and client, the client may read the final reply to the <close-session> rpc after the server has closed the socket. When that occurs, poll() returns POLLHUP in revents meaning the server closed the socket which causes the following error on the client:

ERR: Session 1: communication channel unexpectedly closed.
ERR: Session 1: failed to receive a reply to <close-session>.

When POLLHUP is returned in revents, make sure POLLIN is not present as well (if it is, it means that there is some data left to be read in the socket buffer).

See https://www.greenend.org.uk/rjk/tech/poll.html for more details.

When using the UNIX transport and depending on the timing between the
server and client, the client may read the final reply to the
<close-session> rpc *after* the server has closed the socket. When that
occurs, poll() returns POLLHUP in revents meaning the server closed the
socket which causes the following error on the client:

  ERR: Session 1: communication channel unexpectedly closed.
  ERR: Session 1: failed to receive a reply to <close-session>.

When POLLHUP is returned in revents, make sure POLLIN is not present as
well (if it is, it means that there is some data left to be read in the
socket buffer).

Link: https://www.greenend.org.uk/rjk/tech/poll.html
Signed-off-by: Robin Jarry <robin.jarry@6wind.com>
@michalvasko
Copy link
Copy Markdown
Member

Seems good to me and it makes sense, thanks, merging.

Regards,
Michal

@michalvasko michalvasko merged commit f732adc into CESNET:devel May 15, 2020
@rjarry
Copy link
Copy Markdown
Contributor Author

rjarry commented May 15, 2020

Thanks Michal 👍

@rjarry rjarry deleted the io-pollup branch May 15, 2020 11:20
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.

2 participants