Fix blocked streams blocking reconnects (#19017)

We have observed cases where a blocked stream will block for cancellations.

This happens when response channel is blocked and we want to push an error.
This will have the response mutex locked, which will prevent all other operations until upstream is unblocked.

Make this behavior non-blocking and if blocked spawn a goroutine that will send the response and close the output.

Still a lot of "dancing". Added a test for this and reviewed.
This commit is contained in:
Klaus Post
2024-02-08 10:15:27 -08:00
committed by GitHub
parent a29c66ed74
commit 7ec43bd177
5 changed files with 168 additions and 42 deletions

View File

@@ -41,7 +41,8 @@ type Stream struct {
// Requests sent cannot be used any further by the called.
Requests chan<- []byte
ctx context.Context
muxID uint64
ctx context.Context
}
// Send a payload to the remote server.