Fix mux client memory leak (#18956)

Add missing client cancellation, resulting in memory buildup tracing back to context.WithCancelCause/context.WithCancelDeadlineCause
This commit is contained in:
Klaus Post
2024-02-02 15:31:06 -08:00
committed by GitHub
parent ff80cfd83d
commit 63bf5f42a1
2 changed files with 6 additions and 3 deletions

View File

@@ -63,10 +63,11 @@ func (s *Stream) Send(b []byte) error {
func (s *Stream) Results(next func(b []byte) error) (err error) {
done := false
defer func() {
if s.cancel != nil {
s.cancel(err)
}
if !done {
if s.cancel != nil {
s.cancel(err)
}
// Drain channel.
for range s.responses {
}