Skip to content

Commit

Permalink
fix "bfe_http : readloop goroutine leak #1209"
Browse files Browse the repository at this point in the history
Signed-off-by: xuleiming <[email protected]>
  • Loading branch information
xuleiming committed Jan 13, 2025
1 parent 84df246 commit 0e06df7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bfe_http/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,10 @@ func (pc *persistConn) readLoop() {
err = ReadRespHeaderError{Err: err}
}

pc.lk.Lock()
pc.numExpectedResponses--
pc.lk.Unlock()

rc.ch <- responseAndError{resp, err}

// Wait for the just-returned response body to be fully consumed
Expand Down Expand Up @@ -1051,10 +1055,6 @@ WaitResponse:
}
}

pc.lk.Lock()
pc.numExpectedResponses--
pc.lk.Unlock()

if re.err != nil {
pc.t.setReqConn(req.Request, nil)
}
Expand Down

0 comments on commit 0e06df7

Please sign in to comment.