channel shutdown error obtrudes on network errors
- Lingua principale
- Java
- Stelle
- 12.1k
- Fork
- 4k
- Merge medio
- 2g 17h
- PR unite (30g)
- 37
Descrizione
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`.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Esegui la riproduzione collegata di grpc_shutdown_bug con e senza uno shutdown aggraziato del channel e confronta lo stato terminale. Traccia il percorso di shutdown di ManagedClientChannel; il lavoro è concluso quando la terminazione di un server durante lo shutdown aggraziato segnala UNAVAILABLE: Network closed for unknown reason invece di Channel shutdown invoked.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- networking
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 48/100