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

The GRPC.Adapter.Cowboy.Handler does not handle :EXIT message #184

Closed
bszaf opened this issue Jan 20, 2021 · 2 comments · Fixed by #375
Closed

The GRPC.Adapter.Cowboy.Handler does not handle :EXIT message #184

bszaf opened this issue Jan 20, 2021 · 2 comments · Fixed by #375
Labels

Comments

@bszaf
Copy link
Contributor

bszaf commented Jan 20, 2021

Describe the bug
The GRPC.Adapter.Cowboy.Handler does not handle :shutdown message from Cowboy.

To Reproduce
Steps to reproduce the behavior:

  • Open connection to GRPC Server
  • Open a stream in the context of connection. Possibly long lived
  • Close connection while stream is open: GRPC.Stub.disconnect(channel)

Expected behavior

  1. Let stream handling process know that connection is closed, so it can terminate gracefully.
  2. Optionally log an error/warn. Ideally it could be silenced.

Logs

time=2021-01-20T06:21:01.504 node=backend@10.68.143.164 pid=<0.5844.0> [error] Ranch listener "GRPC.Endpoint", connection process #PID<0.5844.0>, stream 3 had its request process #PID<0.6180.0> exit with reason :function_clause and stacktrace [{GRPC.Adapter.Cowboy.Handler, :info, [{:EXIT, #PID<0.6182.0>, :shutdown}, %{bindings: %{}, body_length: :undefined, cert: <<stripped>>, has_body: true, headers: %{"content-type" => "application/grpc+proto", "te" => "trailers", "user-agent" => "grpc-elixir/0.5.0-beta"}, host: "stripped", host_info: :undefined, method: "POST", path: "/stripped", path_info: :undefined, peer: {{127, 0, 0, 1}, 50090}, pid: #PID<0.5844.0>, port: 443, qs: "", ref: "GRPC.Endpoint", resp_headers: %{"content-type" => "application/grpc+proto"}, scheme: "https", sock: {{127, 0, 0, 1}, 50056}, streamid: 3, version: :"HTTP/2"}, %{handling_timer: nil, pid: #PID<0.6181.0>}], []}, {:cowboy_loop, :call, 5, [file: 'deps/cowboy/src/cowboy_loop.erl', line: 77]}, {:grpc_stream_h, :execute, 3, [file: 'src/grpc_stream_h.erl', line: 348]}, {:grpc_stream_h, :request_process, 3, [file: 'src/grpc_stream_h.erl', line: 330]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}]

Versions:

  • OS:
  • Erlang:
  • Elixir:
  • mix.lock(grpc, gun, cowboy, cowlib):
  "cowboy": {:hex, :cowboy, "2.8.0", "f3dc62e35797ecd9ac1b50db74611193c29815401e53bac9a5c0577bd7bc667d", [:rebar3], [{:cowlib, "~> 2.9.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.7.1", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "4643e4fba74ac96d4d152c75803de6fad0b3fa5df354c71afdd6cbeeb15fac8a"},
  "cowlib": {:hex, :cowlib, "2.9.1", "61a6c7c50cf07fdd24b2f45b89500bb93b6686579b069a89f88cb211e1125c78", [:rebar3], [], "hexpm", "e4175dc240a70d996156160891e1c62238ede1729e45740bdd38064dad476170"},
  "grpc": {:git, "https://github.com/elixir-grpc/grpc.git", "eff8a8828d27ddd7f63a3c1dd5aae86246df215e", []},
  "gun": {:hex, :grpc_gun, "2.0.0", "f99678a2ab975e74372a756c86ec30a8384d3ac8a8b86c7ed6243ef4e61d2729", [:rebar3], [{:cowlib, "~> 2.8.0", [hex: :cowlib, repo: "hexpm", optional: false]}], "hexpm", "03dbbca1a9c604a0267a40ea1d69986225091acb822de0b2dbea21d5815e410b"},
@bszaf bszaf added the bug label Jan 20, 2021
@polvalente
Copy link
Contributor

@bszaf do you have a code snippet so that we can reproduce this bug? We have updated our dependencies recently as well, so that might have changed

@beligante
Copy link
Contributor

Hello Hello Folks! Adding a PR for this error: #375

sleipnir added a commit that referenced this issue Jul 2, 2024
…ss-shutdown

[#184] gracefully handles server process shutdown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants