Let InputStream.read block instead of blocking manually with Thread.sleep #7
  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.
  
    
  
    
Worker threads that are waiting for a work response get interrupted if they are still going after the execution has completed (See RedisShardBackplane.pollExecution and ShardWorkerContext.resumePoller and Executor.runInterruptible). This is happening to us often. Assuming the problem is in buildfarm, and not our rules, it may be that the execution writes its entire response and completes within the span of the Thread.sleep(10) call, and then the poller sees that the execution is complete and interrupts the thread before it gets the chance to check the output stream again. This seems a bit far-fetched, but it's the only explanation I came up with. By letting the read block, instead of manually blocking until the read won't block, we should react to the work response more promptly, and potentially finish before we get interrupted.