Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

websockets close unexpected behavior #3550

Closed
lmarent opened this issue Jan 17, 2019 · 3 comments
Closed

websockets close unexpected behavior #3550

lmarent opened this issue Jan 17, 2019 · 3 comments
Labels
needs-info Issue is lacking sufficient information and will be closed if not provided Stale

Comments

@lmarent
Copy link

lmarent commented Jan 17, 2019

Long story short

unexpected processing during shutdown

Expected behaviour

I am writing a server code that connects clients though WebSockets. The server that I coded calls the close all Websockets connected (maintained in a set as the documentation recommends), and I expect the code calls the close() method of the websocket as many time as web sockets are connected.

Actual behaviour

Right now, there is only one close being called. After the first call, it is like the server continues executing the rest of the shutdown processing.

Steps to reproduce

Start the server with python server.py
Start two clients with with python client.py

Ctrl-C on the sever and you only see one print with the label closing websocket

Your environment

OS: UBUNTU 16.04
Python: 3.6

Libraries Installed
aiohttp==3.5.1
async-timeout==3.0.1
attrs==18.2.0
chardet==3.0.4
idna==2.8
idna-ssl==1.1.0
multidict==4.5.2
typing-extensions==3.6.6
yarl==1.3.0

files.zip

@aio-libs-bot
Copy link

GitMate.io thinks the contributor most likely able to help you is @asvetlov.

Possibly related issues are #194 (websockets), #301 (Secure Websockets?), #691 (Websockets are automatically closed after response), #754 (How to close websockets coroutines ?), and #753 (Websockets in variables).

@lmarent
Copy link
Author

lmarent commented Jan 22, 2019

Hello I saw all the possible related issues and none one applies. The closest is issue 754 and it talks about how to close the client websocket connection. My case applies for web sockets closed by server request.

neolynx added a commit to molior-dbs/molior that referenced this issue Nov 5, 2020
neolynx added a commit to molior-dbs/molior that referenced this issue Feb 28, 2021
@DavidRomanovizc
Copy link
Contributor

Hello, @lmarent, there has been no activity here for the last 3 years, can you confirm that this is still a problem? Also I've reviewed your code and suggest that you consider using asyncio.wait_for() or asyncio.sleep(0) in the on_shutdown() function for better handling of program shutdown. These functions may help ensure that all connections are properly closed before the program terminates.

@Dreamsorcerer Dreamsorcerer added the needs-info Issue is lacking sufficient information and will be closed if not provided label Aug 11, 2024
@github-actions github-actions bot added the Stale label Sep 11, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-info Issue is lacking sufficient information and will be closed if not provided Stale
Projects
None yet
Development

No branches or pull requests

4 participants