Skip to content

open_connection() fails to report connection refused error on OpenBSD #118

@sbourdeauducq

Description

@sbourdeauducq

Repro:

import asyncio
import logging

from PyQt5 import QtWidgets
import qasync

logging.basicConfig(level=logging.DEBUG)

app = QtWidgets.QApplication(["test"])
loop = qasync.QEventLoop(app)
asyncio.set_event_loop(loop)
loop.set_debug(True)
loop.run_until_complete(asyncio.open_connection("127.0.0.1", 3251))  # with the port not open

Output:

DEBUG:asyncio:Using selector: _Selector
DEBUG:qasync._QEventLoop:Running <coroutine object open_connection at 0x6dd6e8f69d0> until complete
DEBUG:qasync._QEventLoop:Registering callback <TaskStepMethWrapper object at 0x6dd6e97ddb0> to be invoked with arguments () after 0 second(s)
DEBUG:qasync._SimpleTimer:Registering timer id 1
DEBUG:qasync._QEventLoop:Starting Qt event loop
DEBUG:qasync._SimpleTimer:Timer event on id 1
DEBUG:qasync._SimpleTimer:Calling handle <Handle <TaskStepMethWrapper object at 0x6dd6e97ddb0>() created at /home/sb/qasync/qasync/__init__.py:472>
DEBUG:qasync._QEventLoop:Adding writer callback for file descriptor 24

Runs until killed and uses 100% CPU.

Expected behavior would be something like:

  File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 541, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 61] Connect call failed ('127.0.0.1', 3251)

(as occurs with the default asyncio event loop)

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions