uvicorn - can't handle connection errors on the server side

21 views Asked by At

I can't find a proper way to handle connection problems for uvicorn.

In my environment, I have very strict limits, that let only few open files.

$ ulimit -n
48

Uvicorn, or OS, silently drop connection requests once number of opened files goes to 48. I review Uvicron source code but could not find any socket.accept() function that handles connections.

When the client can't connect, it receives the following exception, but nothing is logged on the server side.

<class 'websocket._exceptions.WebSocketConnectionClosedException'>
Connection to remote host was lost.

I am looking for any way to detect such situation on the server side. One possible solution is to count the number of opened files, but I'd rather prefer to extend the function that accepts connection.

I see that new TCP connections are dropped with RST, but I can't figure out how exactly this happens. enter image description here

0

There are 0 answers