Hey all! I’ve been having an issue with the websockets portion of my project.
I am using Python 3.6.9, Sanic 20.6.3 and Gino 1.0.1 (gino-sanic 0.1.0). I am also using @ahopkins WS PubSub Example
Issues:
After a Client / Websocket connection is established, everything runs fine until it’s time to restart the server. I shut down the server using supervisorctl and it hangs for about 10 seconds. When I start it up again, I get this error: OSError: [Errno 98] Address already in use
. I use ps
to verify that my server is still running (it is). Additionally, if I refresh my websocket page a bunch of times it locks up.
Edit: Another related issue is that if a browser tab is refreshed a bunch of times, the entire site will lock up.
Cause:
In this case when the handler wrapped by @app.websocket()
is completed (after the client connection is closed), the typical middleware isn’t run, and therefore the database connection is never returned to the pool.
These issues are exacerbated by having a low app.config.DB_POOL_MAX_SIZE