Skip to content

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

@bszaf

Description

@bszaf

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 [email protected] 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"},

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions