# CANCELLED: grpc: stream closed by server shutdown

- **ID:** `grpc/stream-interrupted-by-shutdown`
- **Domain:** grpc
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The server is gracefully shutting down, closing all active streams.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| gRPC Python 1.46.0 | active | — | — |
| gRPC Go 1.50.0 | active | — | — |

## Workarounds

1. **Implement client-side reconnection logic with exponential backoff. Example in Python: `channel = grpc.insecure_channel('target', options=[('grpc.service_config', '{"methodConfig": [{"name": [{}], "retryPolicy": {"maxAttempts": 5, "initialBackoff": "0.1s", "maxBackoff": "1s", "backoffMultiplier": 2, "retryableStatusCodes": ["UNAVAILABLE"]}}]}')])`** (80% success)
   ```
   Implement client-side reconnection logic with exponential backoff. Example in Python: `channel = grpc.insecure_channel('target', options=[('grpc.service_config', '{"methodConfig": [{"name": [{}], "retryPolicy": {"maxAttempts": 5, "initialBackoff": "0.1s", "maxBackoff": "1s", "backoffMultiplier": 2, "retryableStatusCodes": ["UNAVAILABLE"]}}]}')])`
   ```
2. **Use a load balancer to route requests to healthy server instances.** (90% success)
   ```
   Use a load balancer to route requests to healthy server instances.
   ```

## Dead Ends

- **** — The server is down; retries will fail until the server is back. (80% fail)
- **** — Keepalive settings do not prevent server shutdown from closing streams. (60% fail)
- **** — The stream is permanently closed; a new stream must be created. (95% fail)
