Skip to content

Client timeout doesn't work #1433

Open
Open
@olivasmaybell

Description

@olivasmaybell

Describe the bug
Creating a client and connecting to a non-existent endpoint doesn't timeout as expected. It just hangs/cycles.

To Reproduce

from socketio import Client
sio = Client(engineio_logger=True)
print("attempting to connect...")
sio.connect(
    "http://localhost:7777",
    retry=5,
    wait=True,
    wait_timeout=1,
)
print("connected.")

I was testing this using a websocket transport, but that doesn't matter. I also increased the wait_timeout to 10, but that didn't seem to change anything. I don't see where the wait_timeout is being respected.

Expected behavior
I expect it to timeout as opposed to blocking indefinitely.

Logs

Attempting polling connection to http://localhost:7777/socket.io/?transport=polling&EIO=4
HTTP GET request to http://localhost:7777/socket.io/?transport=polling&EIO=4&t=1740072292.5999632 failed with error HTTPConnectionPool(host='localhost', port=7777): Max retries exceeded with url: /socket.io/?transport=polling&EIO=4&t=1740072292.5999632 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fdcdb587d10>: Failed to establish a new connection: [Errno 111] Connection refused')).

This continues indefinitely, printing that error message about once per second.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions