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

ws_connect hang #3027

Closed
liuaifu opened this issue May 24, 2018 · 2 comments
Closed

ws_connect hang #3027

liuaifu opened this issue May 24, 2018 · 2 comments
Labels

Comments

@liuaifu
Copy link

liuaifu commented May 24, 2018

Long story short

ws_connect hang when server port not open, i try to add timeout param, but always hang.

async with session.ws_connect('http://example.org/ws') as ws:

Expected behaviour

Actual behaviour

Steps to reproduce

Your environment

ubuntu-desktop 18.04, python3.6.5 aiohttp 3.2.1

@asvetlov
Copy link
Member

asvetlov commented May 24, 2018

My script

import asyncio

import aiohttp


async def main():
    async with aiohttp.ClientSession() as session:
        async with session.ws_connect('http://example.org/ws') as ws:
            await ws.close()

loop = asyncio.get_event_loop()
loop.run_until_complete(main())

immediatelly returns

Traceback (most recent call last):
  File "1.py", line 12, in <module>
    loop.run_until_complete(main())
  File "/usr/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
    return future.result()
  File "1.py", line 8, in main
    async with session.ws_connect('http://example.org/ws') as ws:
  File "/home/andrew/projects/aiohttp/aiohttp/client.py", line 840, in __aenter__
    self._resp = await self._coro
  File "/home/andrew/projects/aiohttp/aiohttp/client.py", line 606, in _ws_connect
    headers=resp.headers)
aiohttp.client_exceptions.WSServerHandshakeError: 404, message='Invalid response status'

@lock
Copy link

lock bot commented Oct 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs.
If you feel like there's important points made in this discussion, please include those exceprts into that [new issue].
[new issue]: https://github.com/aio-libs/aiohttp/issues/new

@lock lock bot added the outdated label Oct 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants