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

alloc exec: fix panics after stream close #19932

Merged
merged 2 commits into from
Feb 12, 2024
Merged

alloc exec: fix panics after stream close #19932

merged 2 commits into from
Feb 12, 2024

Commits on Feb 9, 2024

  1. alloc exec: fix panics after stream close

    In #19172 we added a check on websocket errors to see if they were one of
    several benign "close" messages. This change inadvertently assumed that other
    messages used for close would not implement `HTTPCodedError`. When errors like
    the following are received:
    
    > msgpack decode error [pos 0]: io: read/write on closed pipe"
    
    they are sent from the inner loop as though they were a "real" error, but the
    channel is already being closed with a "close" message.
    
    This allowed many more attempts to pass thru a previously-undiscovered race
    condition in the two goroutines that stream RPC responses to the websocket. When
    the input stream returns an error for any reason (for example, the command we're
    executing has exited), it will unblock the "outer" goroutine and cause a write
    to the websocket. If we're concurrently writing the "close error" discussed
    above, this results in a panic from the websocket library.
    
    This changeset includes two fixes:
    * Catch "closed pipe" error correctly so that we're not sending unnecessary
      error messages.
    * Move all writes to the websocket into the same response streaming
      goroutine. The main handler goroutine will block on a results channel, and the
      response streaming goroutine will send on that channel with the final error when
      it's done so it can be reported to the user.
    tgross committed Feb 9, 2024
    Configuration menu
    Copy the full SHA
    498c18f View commit details
    Browse the repository at this point in the history

Commits on Feb 12, 2024

  1. Configuration menu
    Copy the full SHA
    3211031 View commit details
    Browse the repository at this point in the history