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

Don't reset RequestCtx.s #1234

Merged
merged 1 commit into from Mar 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion server.go
Expand Up @@ -788,9 +788,14 @@ func (ctx *RequestCtx) reset() {
ctx.connTime = zeroTime
ctx.remoteAddr = nil
ctx.time = zeroTime
ctx.s = nil
ctx.c = nil

// Don't reset ctx.s!
// We have a pool per server so the next time this ctx is used it
// will be assigned the same value again.
// ctx might still be in use for context.Done() and context.Err()
// which are safe to use as they only use ctx.s and no other value.

if ctx.timeoutResponse != nil {
ctx.timeoutResponse.Reset()
}
Expand Down