Skip to content

Backport disconnect FunctionClauseError fix to 0.11.x #534

@saner

Description

@saner

Description

The FunctionClauseError in GRPC.Client.Connection.handle_call/3 during disconnect — originally reported in #492 and #500 — was fixed for the 1.0.0-rc line in #493, but the fix has not been backported to the 0.11.x release line.

Users on 0.11.x (v0.11.2 – v0.11.5) still encounter this crash when calling GRPC.Stub.disconnect/1 because:

  1. real_channels can contain {:error, reason} entries from build_real_channels/4 for failed connections, but the disconnect handler only pattern-matches {_key, {:ok, ch}}.
  2. For direct connections, build_direct_state stores bare %GRPC.Channel{} structs instead of {:ok, channel} tuples.

Both cases cause the Enum.map anonymous function in the disconnect handler to raise a FunctionClauseError.

Expected behavior

GRPC.Stub.disconnect/1 should gracefully handle all channel states (ok, error, bare struct) without crashing the GRPC.Client.Connection process.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions