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

fix(hijack): reset userValues after hijack handler execution #1199

Merged
merged 4 commits into from Jan 18, 2022
Merged

fix(hijack): reset userValues after hijack handler execution #1199

merged 4 commits into from Jan 18, 2022

Conversation

savsgio
Copy link
Contributor

@savsgio savsgio commented Jan 18, 2022

No description provided.

@erikdubbelboer
Copy link
Collaborator

erikdubbelboer commented Jan 18, 2022

Makes sense I guess. The requestCtx isn't reused but you want Close to be called on the values.

@erikdubbelboer erikdubbelboer merged commit 2aca3e8 into valyala:master Jan 18, 2022
9 of 11 checks passed
@savsgio
Copy link
Contributor Author

savsgio commented Jan 18, 2022

Makes sense I guess. The requestCtx isn't reused but you want Close to be called on the values.

That's it, because something values that implement the io.Closer will never close.

Maybe, the RequestCtx can be put back into the pool afterwards too, what do you thing?

@erikdubbelboer
Copy link
Collaborator

erikdubbelboer commented Jan 18, 2022

Yeah I don't see any reason why not.

@savsgio
Copy link
Contributor Author

savsgio commented Jan 19, 2022

Can this be the reason for not put back the RequestCtx to the pool?
https://github.com/valyala/fasthttp/blob/master/server.go#L2383

@erikdubbelboer
Copy link
Collaborator

erikdubbelboer commented Jan 19, 2022

The reason that comment is there is that we can't return ctx to the pool while the hijack handler is still running. That is what not setting ctx = nil there would do. But releasing it to the pool after the hijack handler is done should be ok I think. But please test it well 😄

@savsgio
Copy link
Contributor Author

savsgio commented Jan 20, 2022

Ok haha, I'll make the PR to test it 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants