channel shutdown error obtrudes on network errors
- Vorherrschende Sprache
- Java
- Sterne
- 12.1k
- Forks
- 4k
- Ø Merge
- 2 T. 17 Std.
- Gemergte PRs (30 T.)
- 37
Beschreibung
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`.
Beitragsleitfaden
Rechercherichtung
Führe die verknüpfte grpc_shutdown_bug-Reproduktion mit und ohne ordnungsgemäßes Herunterfahren des Channels aus und vergleiche den finalen Status. Verfolge den Herunterfahrpfad von ManagedClientChannel; fertig, wenn ein Serverausfall während des ordnungsgemäßen Herunterfahrens UNAVAILABLE: Network closed for unknown reason statt Channel shutdown invoked meldet.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- networking
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 48/100