NandaGopal56 / websockets-pubsub

13 stars 4 forks source link

server get hanged when forcefully shut down the server #1

Open nehatkkhan786 opened 7 months ago

nehatkkhan786 commented 7 months ago

hey bro, I implement the chat app by looking at your code and everything works fine, but after some chat, when I try to shutdown the server with ctrl + c command, the server get hanged and dont do anything.

stuck here. INFO: connection closed INFO: Waiting for application shutdown. INFO: Application shutdown complete. INFO: Finished server process [6680]

yarodevuci commented 1 month ago

same here.. @NandaGopal56 your code is poorly written! have you even tested it?

NandaGopal56 commented 1 month ago

@yarodevuci Yes the code is tested. Please provide more details on the issue.Also, the server hang issue should be checked with unicorn and nothing to with the underlying code as per my initial assessment.

yarodevuci commented 1 month ago

@yarodevuci Yes the code is tested. Please provide more details on the issue.Also, the server hang issue should be checked with unicorn and nothing to with the underlying code as per my initial assessment.

code does not work with multipe gunicorn workers

NandaGopal56 commented 1 month ago

@yarodevuci please provide exact error or issue you are facing while using multiple workers. Also not sure why u are using gunicorn workers in fastapi instead of an asgi server although its an unrelated thing

yarodevuci commented 1 month ago

@yarodevuci please provide exact error or issue you are facing while using multiple workers. Also not sure why u are using gunicorn workers in fastapi instead of an asgi server although its an unrelated thing

@NandaGopal56 thank you for getting back on this I am using FastAPI RestAPI with Websockets that are hosted gunicorn -w 4 -k uvicorn.workers.UvicornWorker myapp:app -k uvicorn.workers.UvicornWorker tells Gunicorn to use Uvicorn as the worker class, which enables support for ASGI and WebSocket handling.

I don't have exact errors but messages are skipped if using more than 1 worker

If you believe that it is not a good idea to host endpoints together with websockets , let me know