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

"RuntimeError: Event loop is closed" when running tests with pytest-asyncio 0.23.5.post1 #1631

Closed
penguinpee opened this issue Mar 18, 2024 · 13 comments

Comments

@penguinpee
Copy link

We intend to update pytest-asyncio in Fedora to version 0.23.5.post1. Testing dependent packages showed failing tests in autobahn in wamp and websocket:

Test errors
=================================== FAILURES ===================================
_________________________ TestSigVectors.test_vectors __________________________
self = <autobahn.wamp.test.test_wamp_cryptosign.TestSigVectors testMethod=test_vectors>
    def test_vectors(self):
        session = Mock()
    
        for testvec in test_vectors_1:
            # setup fake transport details including fake channel_id
            if testvec['channel_id']:
                channel_id = binascii.a2b_hex(testvec['channel_id'])
                channel_id_type = 'tls-unique'
                session._transport.transport_details = types.TransportDetails(channel_id={'tls-unique': channel_id})
            else:
                channel_id = None
                channel_id_type = None
                session._transport.transport_details = types.TransportDetails(channel_id=None)
    
            # private signing key (the seed for it)
            private_key = CryptosignKey.from_bytes(binascii.a2b_hex(testvec['private_key']))
    
            # the fake challenge we've received
            challenge = types.Challenge("cryptosign", dict(challenge=testvec['challenge']))
    
            # ok, now sign the challenge
>           f_signed = private_key.sign_challenge(challenge,
                                                  channel_id=channel_id,
                                                  channel_id_type=channel_id_type)
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/wamp/test/test_wamp_cryptosign.py:132: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/wamp/cryptosign.py:521: in sign_challenge
    return _sign_challenge(data, self.sign)
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/wamp/cryptosign.py:436: in _sign_challenge
    txaio.add_callbacks(d1, process, None)
/usr/lib/python3.12/site-packages/txaio/aio.py:493: in add_callbacks
    return future.add_done_callback(done)
/usr/lib64/python3.12/asyncio/base_events.py:793: in call_soon
    self._check_closed()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <_UnixSelectorEventLoop running=False closed=True debug=False>
    def _check_closed(self):
        if self._closed:
>           raise RuntimeError('Event loop is closed')
E           RuntimeError: Event loop is closed
/usr/lib64/python3.12/asyncio/base_events.py:540: RuntimeError
_________________________ TestAuth.test_authenticator __________________________
self = <autobahn.wamp.test.test_wamp_cryptosign.TestAuth testMethod=test_authenticator>
    def test_authenticator(self):
        authenticator = create_authenticator(
            "cryptosign",
            authid="someone",
            authextra={'channel_binding': 'tls-unique'},
            privkey=self.privkey_hex,
        )
        session = Mock()
        session._transport.transport_details = self.transport_details
        challenge = types.Challenge("cryptosign", dict(challenge="ff" * 32))
>       f_reply = authenticator.on_challenge(session, challenge)
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/wamp/test/test_wamp_cryptosign.py:210: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/wamp/auth.py:200: in on_challenge
    return self._privkey.sign_challenge(challenge,
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/wamp/cryptosign.py:521: in sign_challenge
    return _sign_challenge(data, self.sign)
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/wamp/cryptosign.py:436: in _sign_challenge
    txaio.add_callbacks(d1, process, None)
/usr/lib/python3.12/site-packages/txaio/aio.py:493: in add_callbacks
    return future.add_done_callback(done)
/usr/lib64/python3.12/asyncio/base_events.py:793: in call_soon
    self._check_closed()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <_UnixSelectorEventLoop running=False closed=True debug=False>
    def _check_closed(self):
        if self._closed:
>           raise RuntimeError('Event loop is closed')
E           RuntimeError: Event loop is closed
/usr/lib64/python3.12/asyncio/base_events.py:540: RuntimeError
_____________________________ TestAuth.test_valid ______________________________
self = <autobahn.wamp.test.test_wamp_cryptosign.TestAuth testMethod=test_valid>
    def test_valid(self):
        session = Mock()
        session._transport.transport_details = self.transport_details
    
        challenge = types.Challenge("cryptosign", dict(challenge="ff" * 32))
>       f_signed = self.key.sign_challenge(challenge,
                                           channel_id=self.transport_details.channel_id['tls-unique'],
                                           channel_id_type='tls-unique')
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/wamp/test/test_wamp_cryptosign.py:181: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/wamp/cryptosign.py:521: in sign_challenge
    return _sign_challenge(data, self.sign)
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/wamp/cryptosign.py:436: in _sign_challenge
    txaio.add_callbacks(d1, process, None)
/usr/lib/python3.12/site-packages/txaio/aio.py:493: in add_callbacks
    return future.add_done_callback(done)
/usr/lib64/python3.12/asyncio/base_events.py:793: in call_soon
    self._check_closed()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <_UnixSelectorEventLoop running=False closed=True debug=False>
    def _check_closed(self):
        if self._closed:
>           raise RuntimeError('Event loop is closed')
E           RuntimeError: Event loop is closed
/usr/lib64/python3.12/asyncio/base_events.py:540: RuntimeError
_________________ WebSocketClientProtocolTests.test_auto_ping __________________
self = <txaio._common._BatchedTimer object at 0x7f02f1fed280>, delay = 5
func = <bound method WebSocketProtocol.onOpenHandshakeTimeout of <autobahn.websocket.protocol.WebSocketClientProtocol object at 0x7f02f1fefd40>>
args = (), kwargs = {}, now = 847504.172068228, real_time = 847509000
call = <txaio._common._BatchedCall object at 0x7f02f1fed4c0>
diff = 4.8279317719861865
    def call_later(self, delay, func, *args, **kwargs):
        """
        IBatchedTimer API
        """
        # "quantize" the delay to the nearest bucket
        now = self._get_seconds()
        real_time = int(now + delay) * 1000
        real_time -= int(real_time % self._bucket_milliseconds)
        call = _BatchedCall(self, real_time, lambda: func(*args, **kwargs))
        try:
>           self._buckets[real_time][1].append(call)
E           KeyError: 847509000
/usr/lib/python3.12/site-packages/txaio/_common.py:88: KeyError
During handling of the above exception, another exception occurred:
self = <autobahn.websocket.test.test_websocket_protocol.WebSocketClientProtocolTests testMethod=test_auto_ping>
    def setUp(self):
        t = FakeTransport()
        f = WebSocketClientFactory()
        f.log = txaio.make_logger()
        p = WebSocketClientProtocol()
        p.log = txaio.make_logger()
        p.factory = f
        p.transport = t
        p._transport_details = TransportDetails()
    
>       p._connectionMade()
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/test/test_websocket_protocol.py:57: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/protocol.py:3473: in _connectionMade
    WebSocketProtocol._connectionMade(self)
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/protocol.py:1110: in _connectionMade
    self.openHandshakeTimeoutCall = self.factory._batched_timer.call_later(
/usr/lib/python3.12/site-packages/txaio/_common.py:95: in call_later
    delayed_call = self._create_delayed_call(
/usr/lib/python3.12/site-packages/txaio/aio.py:420: in call_later
    return self._loop.call_later(delay, real_call)
/usr/lib64/python3.12/asyncio/base_events.py:759: in call_later
    timer = self.call_at(self.time() + delay, callback, *args,
/usr/lib64/python3.12/asyncio/base_events.py:772: in call_at
    self._check_closed()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <_UnixSelectorEventLoop running=False closed=True debug=False>
    def _check_closed(self):
        if self._closed:
>           raise RuntimeError('Event loop is closed')
E           RuntimeError: Event loop is closed
/usr/lib64/python3.12/asyncio/base_events.py:540: RuntimeError
_________________ WebSocketServerProtocolTests.test_auto_ping __________________
self = <txaio._common._BatchedTimer object at 0x7f02f1feea80>, delay = 5
func = <bound method WebSocketProtocol.onOpenHandshakeTimeout of <autobahn.websocket.protocol.WebSocketServerProtocol object at 0x7f02f1feeae0>>
args = (), kwargs = {}, now = 847504.325946043, real_time = 847509000
call = <txaio._common._BatchedCall object at 0x7f02f1feeb40>
diff = 4.674053956987336
    def call_later(self, delay, func, *args, **kwargs):
        """
        IBatchedTimer API
        """
        # "quantize" the delay to the nearest bucket
        now = self._get_seconds()
        real_time = int(now + delay) * 1000
        real_time -= int(real_time % self._bucket_milliseconds)
        call = _BatchedCall(self, real_time, lambda: func(*args, **kwargs))
        try:
>           self._buckets[real_time][1].append(call)
E           KeyError: 847509000
/usr/lib/python3.12/site-packages/txaio/_common.py:88: KeyError
During handling of the above exception, another exception occurred:
self = <autobahn.websocket.test.test_websocket_protocol.WebSocketServerProtocolTests testMethod=test_auto_ping>
    def setUp(self):
        t = FakeTransport()
        f = WebSocketServerFactory()
        f.log = txaio.make_logger()
        p = WebSocketServerProtocol()
        p.log = txaio.make_logger()
        p.factory = f
        p.transport = t
    
>       p._connectionMade()
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/test/test_websocket_protocol.py:121: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/protocol.py:2574: in _connectionMade
    WebSocketProtocol._connectionMade(self)
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/protocol.py:1110: in _connectionMade
    self.openHandshakeTimeoutCall = self.factory._batched_timer.call_later(
/usr/lib/python3.12/site-packages/txaio/_common.py:95: in call_later
    delayed_call = self._create_delayed_call(
/usr/lib/python3.12/site-packages/txaio/aio.py:420: in call_later
    return self._loop.call_later(delay, real_call)
/usr/lib64/python3.12/asyncio/base_events.py:759: in call_later
    timer = self.call_at(self.time() + delay, callback, *args,
/usr/lib64/python3.12/asyncio/base_events.py:772: in call_at
    self._check_closed()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <_UnixSelectorEventLoop running=False closed=True debug=False>
    def _check_closed(self):
        if self._closed:
>           raise RuntimeError('Event loop is closed')
E           RuntimeError: Event loop is closed
/usr/lib64/python3.12/asyncio/base_events.py:540: RuntimeError
_____ WebSocketServerProtocolTests.test_interpolate_server_status_template _____
self = <txaio._common._BatchedTimer object at 0x7f02f1f5ebd0>, delay = 5
func = <bound method WebSocketProtocol.onOpenHandshakeTimeout of <autobahn.websocket.protocol.WebSocketServerProtocol object at 0x7f02f1f5f0e0>>
args = (), kwargs = {}, now = 847504.471455922, real_time = 847509000
call = <txaio._common._BatchedCall object at 0x7f02f1f5deb0>
diff = 4.5285440779989585
    def call_later(self, delay, func, *args, **kwargs):
        """
        IBatchedTimer API
        """
        # "quantize" the delay to the nearest bucket
        now = self._get_seconds()
        real_time = int(now + delay) * 1000
        real_time -= int(real_time % self._bucket_milliseconds)
        call = _BatchedCall(self, real_time, lambda: func(*args, **kwargs))
        try:
>           self._buckets[real_time][1].append(call)
E           KeyError: 847509000
/usr/lib/python3.12/site-packages/txaio/_common.py:88: KeyError
During handling of the above exception, another exception occurred:
self = <autobahn.websocket.test.test_websocket_protocol.WebSocketServerProtocolTests testMethod=test_interpolate_server_status_template>
    def setUp(self):
        t = FakeTransport()
        f = WebSocketServerFactory()
        f.log = txaio.make_logger()
        p = WebSocketServerProtocol()
        p.log = txaio.make_logger()
        p.factory = f
        p.transport = t
    
>       p._connectionMade()
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/test/test_websocket_protocol.py:121: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/protocol.py:2574: in _connectionMade
    WebSocketProtocol._connectionMade(self)
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/protocol.py:1110: in _connectionMade
    self.openHandshakeTimeoutCall = self.factory._batched_timer.call_later(
/usr/lib/python3.12/site-packages/txaio/_common.py:95: in call_later
    delayed_call = self._create_delayed_call(
/usr/lib/python3.12/site-packages/txaio/aio.py:420: in call_later
    return self._loop.call_later(delay, real_call)
/usr/lib64/python3.12/asyncio/base_events.py:759: in call_later
    timer = self.call_at(self.time() + delay, callback, *args,
/usr/lib64/python3.12/asyncio/base_events.py:772: in call_at
    self._check_closed()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <_UnixSelectorEventLoop running=False closed=True debug=False>
    def _check_closed(self):
        if self._closed:
>           raise RuntimeError('Event loop is closed')
E           RuntimeError: Event loop is closed
/usr/lib64/python3.12/asyncio/base_events.py:540: RuntimeError
________ WebSocketServerProtocolTests.test_sendClose_invalid_code_type _________
self = <txaio._common._BatchedTimer object at 0x7f02f1f5c740>, delay = 5
func = <bound method WebSocketProtocol.onOpenHandshakeTimeout of <autobahn.websocket.protocol.WebSocketServerProtocol object at 0x7f02f1f5c800>>
args = (), kwargs = {}, now = 847504.617766727, real_time = 847509000
call = <txaio._common._BatchedCall object at 0x7f02f1f5c440>
diff = 4.382233273005113
    def call_later(self, delay, func, *args, **kwargs):
        """
        IBatchedTimer API
        """
        # "quantize" the delay to the nearest bucket
        now = self._get_seconds()
        real_time = int(now + delay) * 1000
        real_time -= int(real_time % self._bucket_milliseconds)
        call = _BatchedCall(self, real_time, lambda: func(*args, **kwargs))
        try:
>           self._buckets[real_time][1].append(call)
E           KeyError: 847509000
/usr/lib/python3.12/site-packages/txaio/_common.py:88: KeyError
During handling of the above exception, another exception occurred:
self = <autobahn.websocket.test.test_websocket_protocol.WebSocketServerProtocolTests testMethod=test_sendClose_invalid_code_type>
    def setUp(self):
        t = FakeTransport()
        f = WebSocketServerFactory()
        f.log = txaio.make_logger()
        p = WebSocketServerProtocol()
        p.log = txaio.make_logger()
        p.factory = f
        p.transport = t
    
>       p._connectionMade()
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/test/test_websocket_protocol.py:121: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/protocol.py:2574: in _connectionMade
    WebSocketProtocol._connectionMade(self)
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/protocol.py:1110: in _connectionMade
    self.openHandshakeTimeoutCall = self.factory._batched_timer.call_later(
/usr/lib/python3.12/site-packages/txaio/_common.py:95: in call_later
    delayed_call = self._create_delayed_call(
/usr/lib/python3.12/site-packages/txaio/aio.py:420: in call_later
    return self._loop.call_later(delay, real_call)
/usr/lib64/python3.12/asyncio/base_events.py:759: in call_later
    timer = self.call_at(self.time() + delay, callback, *args,
/usr/lib64/python3.12/asyncio/base_events.py:772: in call_at
    self._check_closed()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <_UnixSelectorEventLoop running=False closed=True debug=False>
    def _check_closed(self):
        if self._closed:
>           raise RuntimeError('Event loop is closed')
E           RuntimeError: Event loop is closed
/usr/lib64/python3.12/asyncio/base_events.py:540: RuntimeError
________ WebSocketServerProtocolTests.test_sendClose_invalid_code_value ________
self = <txaio._common._BatchedTimer object at 0x7f02f1f5e150>, delay = 5
func = <bound method WebSocketProtocol.onOpenHandshakeTimeout of <autobahn.websocket.protocol.WebSocketServerProtocol object at 0x7f02f1f5e540>>
args = (), kwargs = {}, now = 847504.764923327, real_time = 847509000
call = <txaio._common._BatchedCall object at 0x7f02f1f5cd40>
diff = 4.2350766729796305
    def call_later(self, delay, func, *args, **kwargs):
        """
        IBatchedTimer API
        """
        # "quantize" the delay to the nearest bucket
        now = self._get_seconds()
        real_time = int(now + delay) * 1000
        real_time -= int(real_time % self._bucket_milliseconds)
        call = _BatchedCall(self, real_time, lambda: func(*args, **kwargs))
        try:
>           self._buckets[real_time][1].append(call)
E           KeyError: 847509000
/usr/lib/python3.12/site-packages/txaio/_common.py:88: KeyError
During handling of the above exception, another exception occurred:
self = <autobahn.websocket.test.test_websocket_protocol.WebSocketServerProtocolTests testMethod=test_sendClose_invalid_code_value>
    def setUp(self):
        t = FakeTransport()
        f = WebSocketServerFactory()
        f.log = txaio.make_logger()
        p = WebSocketServerProtocol()
        p.log = txaio.make_logger()
        p.factory = f
        p.transport = t
    
>       p._connectionMade()
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/test/test_websocket_protocol.py:121: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/protocol.py:2574: in _connectionMade
    WebSocketProtocol._connectionMade(self)
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/protocol.py:1110: in _connectionMade
    self.openHandshakeTimeoutCall = self.factory._batched_timer.call_later(
/usr/lib/python3.12/site-packages/txaio/_common.py:95: in call_later
    delayed_call = self._create_delayed_call(
/usr/lib/python3.12/site-packages/txaio/aio.py:420: in call_later
    return self._loop.call_later(delay, real_call)
/usr/lib64/python3.12/asyncio/base_events.py:759: in call_later
    timer = self.call_at(self.time() + delay, callback, *args,
/usr/lib64/python3.12/asyncio/base_events.py:772: in call_at
    self._check_closed()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <_UnixSelectorEventLoop running=False closed=True debug=False>
    def _check_closed(self):
        if self._closed:
>           raise RuntimeError('Event loop is closed')
E           RuntimeError: Event loop is closed
/usr/lib64/python3.12/asyncio/base_events.py:540: RuntimeError
_______________ WebSocketServerProtocolTests.test_sendClose_none _______________
self = <txaio._common._BatchedTimer object at 0x7f02f1f5da00>, delay = 5
func = <bound method WebSocketProtocol.onOpenHandshakeTimeout of <autobahn.websocket.protocol.WebSocketServerProtocol object at 0x7f02f1f5da60>>
args = (), kwargs = {}, now = 847504.916905145, real_time = 847509000
call = <txaio._common._BatchedCall object at 0x7f02f1f5dca0>
diff = 4.0830948549555615
    def call_later(self, delay, func, *args, **kwargs):
        """
        IBatchedTimer API
        """
        # "quantize" the delay to the nearest bucket
        now = self._get_seconds()
        real_time = int(now + delay) * 1000
        real_time -= int(real_time % self._bucket_milliseconds)
        call = _BatchedCall(self, real_time, lambda: func(*args, **kwargs))
        try:
>           self._buckets[real_time][1].append(call)
E           KeyError: 847509000
/usr/lib/python3.12/site-packages/txaio/_common.py:88: KeyError
During handling of the above exception, another exception occurred:
self = <autobahn.websocket.test.test_websocket_protocol.WebSocketServerProtocolTests testMethod=test_sendClose_none>
    def setUp(self):
        t = FakeTransport()
        f = WebSocketServerFactory()
        f.log = txaio.make_logger()
        p = WebSocketServerProtocol()
        p.log = txaio.make_logger()
        p.factory = f
        p.transport = t
    
>       p._connectionMade()
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/test/test_websocket_protocol.py:121: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/protocol.py:2574: in _connectionMade
    WebSocketProtocol._connectionMade(self)
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/protocol.py:1110: in _connectionMade
    self.openHandshakeTimeoutCall = self.factory._batched_timer.call_later(
/usr/lib/python3.12/site-packages/txaio/_common.py:95: in call_later
    delayed_call = self._create_delayed_call(
/usr/lib/python3.12/site-packages/txaio/aio.py:420: in call_later
    return self._loop.call_later(delay, real_call)
/usr/lib64/python3.12/asyncio/base_events.py:759: in call_later
    timer = self.call_at(self.time() + delay, callback, *args,
/usr/lib64/python3.12/asyncio/base_events.py:772: in call_at
    self._check_closed()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <_UnixSelectorEventLoop running=False closed=True debug=False>
    def _check_closed(self):
        if self._closed:
>           raise RuntimeError('Event loop is closed')
E           RuntimeError: Event loop is closed
/usr/lib64/python3.12/asyncio/base_events.py:540: RuntimeError
_______ WebSocketServerProtocolTests.test_sendClose_reason_with_no_code ________
self = <txaio._common._BatchedTimer object at 0x7f02f1f5e7e0>, delay = 5
func = <bound method WebSocketProtocol.onOpenHandshakeTimeout of <autobahn.websocket.protocol.WebSocketServerProtocol object at 0x7f02f1f5e840>>
args = (), kwargs = {}, now = 847505.07139691, real_time = 847510000
call = <txaio._common._BatchedCall object at 0x7f02f1f5eb40>
diff = 4.928603089996614
    def call_later(self, delay, func, *args, **kwargs):
        """
        IBatchedTimer API
        """
        # "quantize" the delay to the nearest bucket
        now = self._get_seconds()
        real_time = int(now + delay) * 1000
        real_time -= int(real_time % self._bucket_milliseconds)
        call = _BatchedCall(self, real_time, lambda: func(*args, **kwargs))
        try:
>           self._buckets[real_time][1].append(call)
E           KeyError: 847510000
/usr/lib/python3.12/site-packages/txaio/_common.py:88: KeyError
During handling of the above exception, another exception occurred:
self = <autobahn.websocket.test.test_websocket_protocol.WebSocketServerProtocolTests testMethod=test_sendClose_reason_with_no_code>
    def setUp(self):
        t = FakeTransport()
        f = WebSocketServerFactory()
        f.log = txaio.make_logger()
        p = WebSocketServerProtocol()
        p.log = txaio.make_logger()
        p.factory = f
        p.transport = t
    
>       p._connectionMade()
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/test/test_websocket_protocol.py:121: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/protocol.py:2574: in _connectionMade
    WebSocketProtocol._connectionMade(self)
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/protocol.py:1110: in _connectionMade
    self.openHandshakeTimeoutCall = self.factory._batched_timer.call_later(
/usr/lib/python3.12/site-packages/txaio/_common.py:95: in call_later
    delayed_call = self._create_delayed_call(
/usr/lib/python3.12/site-packages/txaio/aio.py:420: in call_later
    return self._loop.call_later(delay, real_call)
/usr/lib64/python3.12/asyncio/base_events.py:759: in call_later
    timer = self.call_at(self.time() + delay, callback, *args,
/usr/lib64/python3.12/asyncio/base_events.py:772: in call_at
    self._check_closed()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <_UnixSelectorEventLoop running=False closed=True debug=False>
    def _check_closed(self):
        if self._closed:
>           raise RuntimeError('Event loop is closed')
E           RuntimeError: Event loop is closed
/usr/lib64/python3.12/asyncio/base_events.py:540: RuntimeError
____________ WebSocketServerProtocolTests.test_sendClose_str_reason ____________
self = <txaio._common._BatchedTimer object at 0x7f02f1f848c0>, delay = 5
func = <bound method WebSocketProtocol.onOpenHandshakeTimeout of <autobahn.websocket.protocol.WebSocketServerProtocol object at 0x7f02f1f86390>>
args = (), kwargs = {}, now = 847505.218308785, real_time = 847510000
call = <txaio._common._BatchedCall object at 0x7f02f1f86030>
diff = 4.781691215001047
    def call_later(self, delay, func, *args, **kwargs):
        """
        IBatchedTimer API
        """
        # "quantize" the delay to the nearest bucket
        now = self._get_seconds()
        real_time = int(now + delay) * 1000
        real_time -= int(real_time % self._bucket_milliseconds)
        call = _BatchedCall(self, real_time, lambda: func(*args, **kwargs))
        try:
>           self._buckets[real_time][1].append(call)
E           KeyError: 847510000
/usr/lib/python3.12/site-packages/txaio/_common.py:88: KeyError
During handling of the above exception, another exception occurred:
self = <autobahn.websocket.test.test_websocket_protocol.WebSocketServerProtocolTests testMethod=test_sendClose_str_reason>
    def setUp(self):
        t = FakeTransport()
        f = WebSocketServerFactory()
        f.log = txaio.make_logger()
        p = WebSocketServerProtocol()
        p.log = txaio.make_logger()
        p.factory = f
        p.transport = t
    
>       p._connectionMade()
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/test/test_websocket_protocol.py:121: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/protocol.py:2574: in _connectionMade
    WebSocketProtocol._connectionMade(self)
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/protocol.py:1110: in _connectionMade
    self.openHandshakeTimeoutCall = self.factory._batched_timer.call_later(
/usr/lib/python3.12/site-packages/txaio/_common.py:95: in call_later
    delayed_call = self._create_delayed_call(
/usr/lib/python3.12/site-packages/txaio/aio.py:420: in call_later
    return self._loop.call_later(delay, real_call)
/usr/lib64/python3.12/asyncio/base_events.py:759: in call_later
    timer = self.call_at(self.time() + delay, callback, *args,
/usr/lib64/python3.12/asyncio/base_events.py:772: in call_at
    self._check_closed()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <_UnixSelectorEventLoop running=False closed=True debug=False>
    def _check_closed(self):
        if self._closed:
>           raise RuntimeError('Event loop is closed')
E           RuntimeError: Event loop is closed
/usr/lib64/python3.12/asyncio/base_events.py:540: RuntimeError
_____________ WebSocketServerProtocolTests.test_sendClose_toolong ______________
self = <txaio._common._BatchedTimer object at 0x7f02f1f85f70>, delay = 5
func = <bound method WebSocketProtocol.onOpenHandshakeTimeout of <autobahn.websocket.protocol.WebSocketServerProtocol object at 0x7f02f1f87950>>
args = (), kwargs = {}, now = 847505.370747717, real_time = 847510000
call = <txaio._common._BatchedCall object at 0x7f02f1f841a0>
diff = 4.629252283019014
    def call_later(self, delay, func, *args, **kwargs):
        """
        IBatchedTimer API
        """
        # "quantize" the delay to the nearest bucket
        now = self._get_seconds()
        real_time = int(now + delay) * 1000
        real_time -= int(real_time % self._bucket_milliseconds)
        call = _BatchedCall(self, real_time, lambda: func(*args, **kwargs))
        try:
>           self._buckets[real_time][1].append(call)
E           KeyError: 847510000
/usr/lib/python3.12/site-packages/txaio/_common.py:88: KeyError
During handling of the above exception, another exception occurred:
self = <autobahn.websocket.test.test_websocket_protocol.WebSocketServerProtocolTests testMethod=test_sendClose_toolong>
    def setUp(self):
        t = FakeTransport()
        f = WebSocketServerFactory()
        f.log = txaio.make_logger()
        p = WebSocketServerProtocol()
        p.log = txaio.make_logger()
        p.factory = f
        p.transport = t
    
>       p._connectionMade()
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/test/test_websocket_protocol.py:121: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/protocol.py:2574: in _connectionMade
    WebSocketProtocol._connectionMade(self)
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/protocol.py:1110: in _connectionMade
    self.openHandshakeTimeoutCall = self.factory._batched_timer.call_later(
/usr/lib/python3.12/site-packages/txaio/_common.py:95: in call_later
    delayed_call = self._create_delayed_call(
/usr/lib/python3.12/site-packages/txaio/aio.py:420: in call_later
    return self._loop.call_later(delay, real_call)
/usr/lib64/python3.12/asyncio/base_events.py:759: in call_later
    timer = self.call_at(self.time() + delay, callback, *args,
/usr/lib64/python3.12/asyncio/base_events.py:772: in call_at
    self._check_closed()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <_UnixSelectorEventLoop running=False closed=True debug=False>
    def _check_closed(self):
        if self._closed:
>           raise RuntimeError('Event loop is closed')
E           RuntimeError: Event loop is closed
/usr/lib64/python3.12/asyncio/base_events.py:540: RuntimeError
__________ WebSocketServerProtocolTests.test_sendClose_unicode_reason __________
self = <txaio._common._BatchedTimer object at 0x7f02f1f84a40>, delay = 5
func = <bound method WebSocketProtocol.onOpenHandshakeTimeout of <autobahn.websocket.protocol.WebSocketServerProtocol object at 0x7f02f1f866c0>>
args = (), kwargs = {}, now = 847505.517936312, real_time = 847510000
call = <txaio._common._BatchedCall object at 0x7f02f1f84d10>
diff = 4.482063687988557
    def call_later(self, delay, func, *args, **kwargs):
        """
        IBatchedTimer API
        """
        # "quantize" the delay to the nearest bucket
        now = self._get_seconds()
        real_time = int(now + delay) * 1000
        real_time -= int(real_time % self._bucket_milliseconds)
        call = _BatchedCall(self, real_time, lambda: func(*args, **kwargs))
        try:
>           self._buckets[real_time][1].append(call)
E           KeyError: 847510000
/usr/lib/python3.12/site-packages/txaio/_common.py:88: KeyError
During handling of the above exception, another exception occurred:
self = <autobahn.websocket.test.test_websocket_protocol.WebSocketServerProtocolTests testMethod=test_sendClose_unicode_reason>
    def setUp(self):
        t = FakeTransport()
        f = WebSocketServerFactory()
        f.log = txaio.make_logger()
        p = WebSocketServerProtocol()
        p.log = txaio.make_logger()
        p.factory = f
        p.transport = t
    
>       p._connectionMade()
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/test/test_websocket_protocol.py:121: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/protocol.py:2574: in _connectionMade
    WebSocketProtocol._connectionMade(self)
../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/websocket/protocol.py:1110: in _connectionMade
    self.openHandshakeTimeoutCall = self.factory._batched_timer.call_later(
/usr/lib/python3.12/site-packages/txaio/_common.py:95: in call_later
    delayed_call = self._create_delayed_call(
/usr/lib/python3.12/site-packages/txaio/aio.py:420: in call_later
    return self._loop.call_later(delay, real_call)
/usr/lib64/python3.12/asyncio/base_events.py:759: in call_later
    timer = self.call_at(self.time() + delay, callback, *args,
/usr/lib64/python3.12/asyncio/base_events.py:772: in call_at
    self._check_closed()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <_UnixSelectorEventLoop running=False closed=True debug=False>
    def _check_closed(self):
        if self._closed:
>           raise RuntimeError('Event loop is closed')
E           RuntimeError: Event loop is closed
/usr/lib64/python3.12/asyncio/base_events.py:540: RuntimeError
=============================== warnings summary ===============================
wamp/test/test_wamp_component_aio.py::test_asyncio_component
  ../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/wamp/test/test_wamp_component_aio.py:36: PytestWarning: The test <Function test_asyncio_component> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove the asyncio mark. If the test is not marked explicitly, check for global marks applied via 'pytestmark'.
    @pytest.mark.skipif(sys.version_info < (3, 5), reason="requires Python 3.5+")
wamp/test/test_wamp_component_aio.py::test_asyncio_component_404
  ../../BUILDROOT/python-autobahn-23.6.2-3.fc39.x86_64/usr/lib/python3.12/site-packages/autobahn/wamp/test/test_wamp_component_aio.py:77: PytestWarning: The test <Function test_asyncio_component_404> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove the asyncio mark. If the test is not marked explicitly, check for global marks applied via 'pytestmark'.
    @pytest.mark.skipif(sys.version_info < (3, 5), reason="requires Python 3.5+")
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED wamp/test/test_wamp_cryptosign.py::TestSigVectors::test_vectors - Runt...
FAILED wamp/test/test_wamp_cryptosign.py::TestAuth::test_authenticator - Runt...
FAILED wamp/test/test_wamp_cryptosign.py::TestAuth::test_valid - RuntimeError...
FAILED websocket/test/test_websocket_protocol.py::WebSocketClientProtocolTests::test_auto_ping
FAILED websocket/test/test_websocket_protocol.py::WebSocketServerProtocolTests::test_auto_ping
FAILED websocket/test/test_websocket_protocol.py::WebSocketServerProtocolTests::test_interpolate_server_status_template
FAILED websocket/test/test_websocket_protocol.py::WebSocketServerProtocolTests::test_sendClose_invalid_code_type
FAILED websocket/test/test_websocket_protocol.py::WebSocketServerProtocolTests::test_sendClose_invalid_code_value
FAILED websocket/test/test_websocket_protocol.py::WebSocketServerProtocolTests::test_sendClose_none
FAILED websocket/test/test_websocket_protocol.py::WebSocketServerProtocolTests::test_sendClose_reason_with_no_code
FAILED websocket/test/test_websocket_protocol.py::WebSocketServerProtocolTests::test_sendClose_str_reason
FAILED websocket/test/test_websocket_protocol.py::WebSocketServerProtocolTests::test_sendClose_toolong
FAILED websocket/test/test_websocket_protocol.py::WebSocketServerProtocolTests::test_sendClose_unicode_reason
==== 13 failed, 195 passed, 64 skipped, 13 deselected, 2 warnings in 6.58s =====

Switching autobahn to use twisted for the time being wasn't as straight forward as I had hoped, either.

Cc: @Jenselme (Fedora package maintainer)

@danigm
Copy link

danigm commented Apr 25, 2024

I think that this PR fixes this issue: #1634

bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Apr 25, 2024
https://build.opensuse.org/request/show/1170112
by user dgarcia + anag+factory
- Add upstream patch fix-wamp-tests.patch to make it work with modern
  python-pytest-asyncio package gh#crossbario/autobahn-python#1631
@oberstet
Copy link
Contributor

yes, this is released on https://github.com/crossbario/autobahn-python/tree/v23.6.2

@dimbleby
Copy link
Contributor

yes, this is released on https://github.com/crossbario/autobahn-python/tree/v23.6.2

it is not. v23.6.2 dates from June 2023.

@oberstet
Copy link
Contributor

@dimbleby
Copy link
Contributor

will there be a corresponding pypi release?

@penguinpee
Copy link
Author

For what it's worth, I applied the fix as a patch on top of 23.6.2 and it fixes the issue reported. At least we know it's working. 😉

@oberstet
Copy link
Contributor

yes, I will push a release soonish. I tried actually at the time when I tagged the release - exactly like we always did. But even though I have 2FA on my PyPI, I ran into issues .. they changed sth. Anyways, I will look to get it done as soon as I find time.

@meejah
Copy link
Contributor

meejah commented Apr 29, 2024

Here's my latest knowledge on that, stated as a Makefile: https://github.com/meejah/fowl/blob/main/Makefile#L32

(You have to create a "token" now, ideally scoped to just the one thing)

image

@oberstet
Copy link
Contributor

I tried with ${HOME}/.pypirc

[distutils]
index-servers =
  pypi
  pypitest

[pypi]
username = __token__
password = pypi-AgEIcH...

[pypitest]
username = __token__
password = pypi-AgEIcH...

but it fails (auth error) ... will recheck tomorrow

@oberstet
Copy link
Contributor

oberstet commented Apr 29, 2024

this was trying "manual release publishing".

yet another issue is making "automatic release publishing" (pypa/gh-action-pypi-publish@release/v1)

https://github.com/crossbario/autobahn-python/blob/master/.github/workflows/deploy.yml

work again.

@oberstet
Copy link
Contributor

cool logo btw! =)

grafik

@dimbleby
Copy link
Contributor

no release yet?

@oberstet
Copy link
Contributor

no release yet?

sorry, the PyPI issue got me unrailed trying to fix the release:( I will try again .. hope to get back to a reasonable / working flow ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants