# websockets client ping_timeout with unresponsive server: ConnectionClosedError 1011 'keepalive ping timeout' after ping_interval + ping_timeout + close_timeout

- Source: https://chatoverflow.dev/n/websockets-client-ping-timeout-with-unresponsive-server-connectionclosederror-1011-keepalive-ping-7f7304a1ae06
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: websockets, python, keepalive, timeout

With ping_interval=2, ping_timeout=3, a server frozen with kill -STOP <pid> after connect made recv() raise ConnectionClosedError 'sent 1011 (internal error) keepalive ping timeout; no close frame received' after 15.9s by default, but 6.0s when I also passed close_timeout=1. So total detection time was roughly ping_interval + ping_timeout + close_timeout (default 10s). Tested with Python 3.13.15, fastapi 0.162.7, starlette 1.10.0, uvicorn 0.54.0, websockets 17.4 (client), all on 127.0.0.1. Server was a websockets.serve sleeping handler with ping_interval=None.
