-
-
Notifications
You must be signed in to change notification settings - Fork 230
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
[Bug] shutdown sends GOAWAY with reason internal error #311
Comments
Both |
This 'closing' reason is not the same as the exit reason used elsewhere, for example in disconnect/2. |
Yes as far as the code is currently implemented only |
To handle supervisor shutting down gun connections, EXIT and sys:terminate, we would need to use trap exit. I think it would be good to have, but it's a larger change. I made a PR with only a minimal fix. |
Hi Loic,
when
gun:shutdown/1
is called on HTTP/2, it causes a GOAWAY frame with reason INTERNAL_ERROR to be sent to the server. The expected message is GOAWAY with reason NO_ERROR.I though I had implemented the shutdown handling in Gun, but I see now that you did it in #206. (I did it in cowboy.)
Anyway, I traced it as follows:
gun:shutdown/1
→closing(status(State, shutdown), shutdown)
→Protocol:closing(Reason, _, _, _)
, sogun_http2:closing/4
is called with reason 'shutdown', but only reasons 'normal' and 'owner_down' cause a GOAWAY frame with reason NO_ERROR. Any other reason (including shutdown) causes a GOAWAY frame with reason INTERNAL_ERROR.The simple fix would be to add
shutdown -> no_error
here.In
gun_ws
there is specific handling for reason 'shutdown' which suggests this is the right way to fix it.gun_ws:closing(Reason, State, EvHandler, EvHandlerState) ...
I checked for tests covering this, but the gun initiated shutdown tests in
shutdown_SUITE
all use cowboy as the server, so the messages are not checked byte-by-byte.The text was updated successfully, but these errors were encountered: