error_all_requests() at connection.py:1035 always wraps the error:
new_exc = ConnectionShutdown(str(exc))
This means whether the connection failed due to:
- Expected closure: driver shutting down, graceful server disconnect
- Unexpected I/O failure:
ECONNRESET, EPIPE, EBADF mid-operation
...pending requests always receive ConnectionShutdown. The retry policy and Session._handle_error cannot distinguish between these cases.
This matters because:
- Expected closures are safe to retry immediately on another host
- Unexpected failures might indicate a problematic node (worth logging warnings, backing off)
Possible fix direction: Preserve the original exception through error_all_requests(), or introduce error subclasses that carry both the shutdown signal and the underlying cause.
error_all_requests()at connection.py:1035 always wraps the error:This means whether the connection failed due to:
ECONNRESET,EPIPE,EBADFmid-operation...pending requests always receive
ConnectionShutdown. The retry policy andSession._handle_errorcannot distinguish between these cases.This matters because:
Possible fix direction: Preserve the original exception through
error_all_requests(), or introduce error subclasses that carry both the shutdown signal and the underlying cause.