Skip to content

Commit

Permalink
Merge pull request #1210 from xuleiming/develop
Browse files Browse the repository at this point in the history
fix "bfe_http : readloop goroutine leak #1209"
  • Loading branch information
mileszhang2016 authored Jan 14, 2025
2 parents ea2c62e + 0e06df7 commit b1c83a2
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 b1c83a2

Please sign in to comment.