Skip to content

CI flake test_websocket on macos #9323

Open

Description

@daywalker90

this test is still flaky after #9148:

node_factory = <pyln.testing.utils.NodeFactory object at 0x104d55000>

    def test_websocket(node_factory):
        ws_port = node_factory.get_unused_port()
        port = node_factory.get_unused_port()
>       l1, l2 = node_factory.line_graph(2,
                                         opts=[{'addr': ':' + str(port),
                                                'bind-addr': 'ws:127.0.0.1: ' + str(ws_port),
                                                'dev-allow-localhost': None},
                                               {'dev-allow-localhost': None}],
                                         wait_for_announce=True)

tests/test_connection.py:3924: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
contrib/pyln-testing/pyln/testing/utils.py:1971: in line_graph
    self.join_nodes(nodes, fundchannel, fundamount, wait_for_announce, announce_channels)
contrib/pyln-testing/pyln/testing/utils.py:1935: in join_nodes
    txids.append(src.rpc.fundchannel(dst.info['id'], fundamount, announce=announce_channels)['txid'])
contrib/pyln-client/pyln/client/lightning.py:807: in fundchannel
    return self.call("fundchannel", payload)
contrib/pyln-testing/pyln/testing/utils.py:922: in call
    res = LightningRpc.call(self, method, payload, cmdprefix, filter)
contrib/pyln-client/pyln/client/lightning.py:404: in call
    resp, buf = self._readobj(sock, buf)
contrib/pyln-client/pyln/client/lightning.py:321: in _readobj
    b = sock.recv(max(1024, len(buff)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pyln.client.lightning.UnixSocket object at 0x103962b60>, length = 1024

    def recv(self, length: int) -> bytes:
        if self.sock is None:
            raise socket.error("not connected")
    
>       return self.sock.recv(length)
E       Failed: Timeout (>1800.0s) from pytest-timeout.

contrib/pyln-client/pyln/client/lightning.py:290: Failed

interesting log entries:

connectd: Created listener on [::]:49311
connectd: Failed to connect 30 socket: No route to host
connectd: Created listener on 0.0.0.0:49311

full run example:
https://github.com/ElementsProject/lightning/actions/runs/29491200333/job/87597479663?pr=9188

Activity

  1. added this to the v26.09 milestone on Jul 17, 2026
  2. daywalker90 commented on Jul 23, 2026

    @daywalker90
    CollaboratorAuthor

    Got a new run (https://github.com/ElementsProject/lightning/actions/runs/30006390823/job/89203289377?pr=9346) with a slightly different error:

    ==================================== ERRORS ====================================
    _____________________ ERROR at teardown of test_websocket ______________________
    [gw1] darwin -- Python 3.10.11 /Users/runner/work/lightning/lightning/.venv/bin/python
    
    request = <SubRequest 'teardown_checks' for <Function test_websocket>>
    
        @pytest.fixture
        def teardown_checks(request):
            """A simple fixture to collect errors during teardown.
        
            We need to collect the errors and raise them as the very last step in the
            fixture tree, otherwise some fixtures may not be cleaned up
            correctly. Require this fixture in all other fixtures that need to either
            cleanup before reporting an error or want to add an error that is to be
            reported.
        
            """
            errors = TeardownErrors()
            yield errors
        
            if errors.has_errors():
                # Format a nice list of everything that went wrong and raise an exception
                request.node.has_errors = True
    >           raise ValueError(str(errors))
    E           ValueError: 
    E           Node errors:
    E            - lightningd-1: had BROKEN or That's weird messages
    E            - lightningd-1: Node exited with return code 1
    E           Global errors:
    
    contrib/pyln-testing/pyln/testing/fixtures.py:238: ValueError
    
    lightningd-1 2026-07-23T12:27:48.762Z DEBUG   plugin-chanbackup: Chanbackup Initialised!
    lightningd-1 2026-07-23T12:27:48.762Z INFO    plugin-chanbackup: Creating Emergency Recovery
    lightningd-2 2026-07-23T12:27:48.762Z DEBUG   hsmd: Client: Received message 27 from client
    lightningd-2 2026-07-23T12:27:48.763Z DEBUG   hsmd: Client: Received message 27 from client
    lightningd-2 2026-07-23T12:27:48.763Z DEBUG   hsmd: Client: Received message 27 from client
    lightningd-1 2026-07-23T12:27:48.764Z DEBUG   plugin-recklessrpc: plugin initialized!
    lightningd-1 2026-07-23T12:27:48.765Z DEBUG   plugin-recklessrpc: lightning-dir: /tmp/ltests-ljy4ljqi/test_websocket_1/lightning-1/
    lightningd-1 2026-07-23T12:27:48.766Z TRACE   plugin-cln-askrene: json_askrene_create_layer called: {"layer":"xpay","persistent":true}
    lightningd-2 2026-07-23T12:27:48.770Z DEBUG   connectd: REPLY WIRE_CONNECTD_ACTIVATE_REPLY with 0 fds
    lightningd-2 2026-07-23T12:27:48.770Z DEBUG   lightningd: io_break: connect_activate_done
    lightningd-1 2026-07-23T12:27:48.771Z DEBUG   plugin-bookkeeper: JSON reply with unknown id '{"jsonrpc":"2.0","id":"cln:init#56/bookkeeper:datastore#6","result":{"key":["bookkeeper","account","wallet"],"generation":0,"hex":"77616c6c6574000000000000000000000000000000000000"}}'
    lightningd-2 2026-07-23T12:27:48.771Z DEBUG   lightningd: io_loop: connectd_activate
    lightningd-2 2026-07-23T12:27:48.771Z INFO    lightningd: --------------------------------------------------
    lightningd-2 2026-07-23T12:27:48.771Z INFO    lightningd: Server started with public key 033845802d25b4e074ccfd7cd8b339a41dc75bf9978a034800444b51d42b07799a, alias SILENTGOPHER-e19be0b (color #033845) and lightningd e19be0b
    lightningd-1 2026-07-23T12:27:48.789Z DEBUG   hsmd: Client: Received message 27 from client
    lightningd-1 2026-07-23T12:27:48.789Z DEBUG   hsmd: Client: Received message 27 from client
    lightningd-1 2026-07-23T12:27:48.790Z DEBUG   connectd: REPLY WIRE_CONNECTD_ACTIVATE_REPLY with 0 fds
    lightningd-1 2026-07-23T12:27:48.790Z DEBUG   lightningd: io_break: connect_activate_done
    lightningd-1 2026-07-23T12:27:48.790Z DEBUG   lightningd: io_loop: connectd_activate
    lightningd-1 2026-07-23T12:27:48.790Z INFO    lightningd: --------------------------------------------------
    lightningd-1 2026-07-23T12:27:48.790Z INFO    lightningd: Server started with public key 038194b5f32bdf0aa59812c86c4ef7ad2f294104fa027d1ace9b469bb6f88cf37b, alias STRANGEBOUNCE-e19be0b (color #038194) and lightningd e19be0b
    lightningd-1 2026-07-23T12:27:48.792Z DEBUG   hsmd: Client: Received message 27 from client
    lightningd-2 2026-07-23T12:27:48.826Z DEBUG   lightningd: Adding block 101: 106f75d6663ed6c9b1cd2c62559232b75d20683c14f65cda5315c26bba3b0097
    lightningd-2 2026-07-23T12:27:48.837Z DEBUG   gossipd: REPLY WIRE_GOSSIPD_NEW_BLOCKHEIGHT_REPLY with 0 fds
    lightningd-1 2026-07-23T12:27:48.837Z DEBUG   lightningd: Adding block 101: 106f75d6663ed6c9b1cd2c62559232b75d20683c14f65cda5315c26bba3b0097
    lightningd-1 2026-07-23T12:27:48.845Z DEBUG   gossipd: REPLY WIRE_GOSSIPD_NEW_BLOCKHEIGHT_REPLY with 0 fds
    lightningd-1 2026-07-23T12:27:49.009Z DEBUG   033845802d25b4e074ccfd7cd8b339a41dc75bf9978a034800444b51d42b07799a-connectd: Transient connection to peer (not important)
    lightningd-1 2026-07-23T12:27:49.010Z DEBUG   033845802d25b4e074ccfd7cd8b339a41dc75bf9978a034800444b51d42b07799a-connectd: Connected out, starting crypto
    lightningd-2 2026-07-23T12:27:49.011Z DEBUG   033845802d25b4e074ccfd7cd8b339a41dc75bf9978a034800444b51d42b07799a-hsmd: Got WIRE_HSMD_ECDH_REQ
    lightningd-2 2026-07-23T12:27:49.011Z DEBUG   hsmd: Client: Received message 1 from client
    lightningd-1 2026-07-23T12:27:49.011Z **BROKEN** connectd: STATUS_FAIL_HSM_IO: No hsmd ECDH response
    
    =================================== FAILURES ===================================
    ________________________________ test_websocket ________________________________
    [gw1] darwin -- Python 3.10.11 /Users/runner/work/lightning/lightning/.venv/bin/python
    
    node_factory = <pyln.testing.utils.NodeFactory object at 0x105f9ba00>
    
        def test_websocket(node_factory):
            ws_port = node_factory.get_unused_port()
            port = node_factory.get_unused_port()
    >       l1, l2 = node_factory.line_graph(2,
                                             opts=[{'addr': ':' + str(port),
                                                    'bind-addr': 'ws:127.0.0.1: ' + str(ws_port),
                                                    'dev-allow-localhost': None},
                                                   {'dev-allow-localhost': None}],
                                             wait_for_announce=True)
    
    tests/test_connection.py:3924: 
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    contrib/pyln-testing/pyln/testing/utils.py:1971: in line_graph
        self.join_nodes(nodes, fundchannel, fundamount, wait_for_announce, announce_channels)
    contrib/pyln-testing/pyln/testing/utils.py:1915: in join_nodes
        src.rpc.connect(dst.info['id'], 'localhost', dst.port)
    contrib/pyln-client/pyln/client/lightning.py:553: in connect
        return self.call("connect", payload)
    contrib/pyln-testing/pyln/testing/utils.py:922: in call
        res = LightningRpc.call(self, method, payload, cmdprefix, filter)
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    
    self = <pyln.testing.utils.PrettyPrintingLightningRpc object at 0x105f9b640>
    method = 'connect'
    payload = {'host': 'localhost', 'id': '033845802d25b4e074ccfd7cd8b339a41dc75bf9978a034800444b51d42b07799a', 'port': 49323}
    cmdprefix = None, filter = None
    
        def call(self, method, payload=None, cmdprefix=None, filter=None):
            """Generic call API: you can set cmdprefix here, or set self.cmdprefix
            before the call is made.
        
            """
            self.logger.debug("Calling %s with payload %r", method, payload)
        
            if payload is None:
                payload = {}
            # Filter out arguments that are None
            if isinstance(payload, dict):
                payload = {k: v for k, v in payload.items() if v is not None}
        
            this_id = self.get_json_id(method, cmdprefix)
            self.next_id += 1
        
            # FIXME: we open a new socket for every readobj call...
            sock = UnixSocket(self.socket_path)
        
            buf = b''
        
            if self._notify is not None:
                # Opt into the notifications support
                self._writeobj(sock, {
                    "jsonrpc": "2.0",
                    "method": "notifications",
                    "id": this_id + "+notify-enable",
                    "params": {
                        "enable": True
                    },
                })
                # FIXME: Notification schema support?
                _, buf = self._readobj(sock, buf)
        
            request = {
                "jsonrpc": "2.0",
                "method": method,
                "params": payload,
                "id": this_id,
            }
        
            if filter is None:
                filter = self._filter
            if filter is not None:
                request["filter"] = filter
        
            self._writeobj(sock, request)
            while True:
                resp, buf = self._readobj(sock, buf)
                id = resp.get("id", None)
                meth = resp.get("method", None)
        
                if meth == 'message' and self._notify is not None:
                    n = resp['params']
                    self._notify(
                        message=n.get('message', None),
                        progress=n.get('progress', None),
                        request=request
                    )
                    continue
        
                if meth is None or id is None:
                    break
        
            self.logger.debug("Received response for %s call: %r", method, resp)
            if 'id' in resp and resp['id'] != this_id:
                raise ValueError("Malformed response, id is not {}: {}.".format(this_id, resp))
            sock.close()
        
            if not isinstance(resp, dict):
                raise TypeError("Malformed response, response is not a dictionary %s." % resp)
            elif "error" in resp:
    >           raise RpcError(method, payload, resp['error'])
    E           pyln.client.lightning.RpcError: RPC call failed: method: connect, payload: {'id': '033845802d25b4e074ccfd7cd8b339a41dc75bf9978a034800444b51d42b07799a', 'host': 'localhost', 'port': 49323}, error: Connection to RPC server lost.
    
    contrib/pyln-client/pyln/client/lightning.py:428: RpcError
    
  3. modified the milestones: v26.09, v26.12 on Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions