Fix an infinite loop in rbssh when writing to a closed pipe.

Review Request #12861 — Created March 2, 2023 and submitted

Information

Review Board
release-5.0.x

Reviewers

When encountering an error writing to stdout or stderr, rbssh will try
again until successful, assuming that the pipe was just blocked.
However, if the pipe is closed, it just spins forever. This can happen
if a caller closes stdout/stderr before all output has been exhausted.

This change fixes that to listen for a closed pipe, and just gives up on
writing.

It also removes the new addition of a sleep call, which would have made
sense when polling, but not when blocking on output. It just caused
rbssh to be slower.

All unit tests passed.

Ran through a reproduction case that resulted in an infinite loop due
to a closed pipe. Verified it's been fixed.

Summary ID
Fix an infinite loop in rbssh when writing to a closed pipe.
When encountering an error writing to stdout or stderr, rbssh will try again until successful, assuming that the pipe was just blocked. However, if the pipe is closed, it just spins forever. This can happen if a caller closes stdout/stderr before all output has been exhausted. This change fixes that to listen for a closed pipe, and just gives up on writing. It also removes the new addition of a sleep call, which would have made sense when polling, but not when blocking on output. It just caused rbssh to be slower.
8203cf2682474d88c58c7bfe5d6df764bc964581
david
  1. Ship It!
  2. 
      
maubin
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-5.0.x (c831a1c)
Loading...