Skip to content

channel shutdown error obtrudes on network errors #12812

@benjaminp

Description

@benjaminp

When a call on a gracefully-terminating ManagedClientChannel experiences a network error, the call is closed with a message suggesting the error is from channel closing rather than the network.

See my reproduction at https://github.com/benjaminp/grpc_shutdown_bug. The program in that repository

  1. starts a server
  2. makes a channel to the server
  3. starts a server-streaming call on the channel
  4. (optionally) shuts down the client channel
  5. forcibly kills the server.

When the client channel is shutdown, the client sees a UNAVAILABLE: Channel shutdown invoked error on server death:

$ ./gradlew run
> Task :run
client: launching server: build/install/streaming-demo-client/bin/streaming-demo-server
client: server pid=234110 port=44637
client: creating channel
client: starting server-streaming RPC
client: reading 1 message
May 15, 2026 3:07:05 PM io.grpc.netty.TcpMetrics loadEpollInfo
INFO: Epoll available during static init of TcpMetrics:false
May 15, 2026 3:07:05 PM io.grpc.netty.TcpMetrics loadEpollInfo
INFO: Epoll available during static init of TcpMetrics:false
client: read: 0
client: shutting down channel (graceful)
client: channel.isShutdown=true isTerminated=false
client: reading another message
client: read: 1
client: server exited with 137
client: draining until error
client: drained with error: io.grpc.StatusException: UNAVAILABLE: Channel shutdown invoked
done

Contrast with the error when the channel is not shutdown:

$ ./gradlew run --args=--noshutdown

> Task :run
client: launching server: build/install/streaming-demo-client/bin/streaming-demo-server
client: server pid=234631 port=39449
client: creating channel
client: starting server-streaming RPC
client: reading 1 message
client: read: 0
client: shutting down channel (graceful)
client: channel.isShutdown=false isTerminated=false
client: reading another message
client: read: 1
client: server exited with 137
client: draining until error
client: drained with error: io.grpc.StatusException: UNAVAILABLE: Network closed for unknown reason
done

I believe the first case should also fail with UNAVAILABLE: Network closed for unknown reason.

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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions