lightning icon indicating copy to clipboard operation
lightning copied to clipboard

Error right after `make -j$(nproc) check VALGRIND=0`

Open w0xlt opened this issue 2 years ago • 3 comments

I am following the INSTALL.md and getting the error below right after make -j$(nproc) check VALGRIND=0.

I am building from the master branch.

OS: Ubuntu 21.10

...
rm -f /home/lightning/testinstall/usr/local/share/doc/c-lightning/LICENSE
make[1]: Leaving directory '/home/lightning'
FAILED                      [  7%]

================================ FAILURES ================================
_______________________________ test_init ________________________________

runner = <lnprototest.clightning.clightning.Runner object at 0x7f75e8b2f0d0>
namespaceoverride = <function namespaceoverride.<locals>._setter at 0x7f75e8a9cb80>

    def test_init(runner: Runner, namespaceoverride: Any) -> None:
        # We override default namespace since we only need BOLT1
        namespaceoverride(pyln.spec.bolt1.namespace)
        test = [
            Connect(connprivkey="03"),
            ExpectMsg("init"),
            Msg("init", globalfeatures="", features=""),
            # optionally disconnect that first one
            TryAll([], Disconnect()),
            Connect(connprivkey="02"),
            TryAll(
                # Even if we don't send anything, it should send init.
                [ExpectMsg("init")],
                # Minimal possible init message.
                # BOLT #1:
                # The sending node:
                #  - MUST send `init` as the first Lightning message for any connection.
                [ExpectMsg("init"), Msg("init", globalfeatures="", features="")],
                # BOLT #1:
                # The sending node:...
                #  - SHOULD NOT set features greater than 13 in `globalfeatures`.
                [
                    ExpectMsg("init", if_match=no_gf13),
                    # BOLT #1:
                    # The receiving node:...
                    #  - upon receiving unknown _odd_ feature bits that are non-zero:
                    #    - MUST ignore the bit.
                    # init msg with unknown odd global bit (99): no error
                    Msg("init", globalfeatures=bitfield(99), features=""),
                ],
                # Sanity check that bits 98 and 99 are not used!
                [
                    ExpectMsg("init", if_match=functools.partial(no_feature, [98, 99])),
                    # BOLT #1:
                    # The receiving node:...
                    #  - upon receiving unknown _odd_ feature bits that are non-zero:
                    #    - MUST ignore the bit.
                    # init msg with unknown odd local bit (99): no error
                    Msg("init", globalfeatures="", features=bitfield(99)),
                ],
                # BOLT #1:
                # The receiving node: ...
                #  - upon receiving unknown _even_ feature bits that are non-zero:
                #    - MUST fail the connection.
                [
                    ExpectMsg("init"),
                    Msg("init", globalfeatures="", features=bitfield(98)),
                    ExpectError(),
                ],
                # init msg with unknown even global bit (98): you will error
                [
                    ExpectMsg("init"),
                    Msg("init", globalfeatures=bitfield(98), features=""),
                    ExpectError(),
                ],
                # If you don't support `option_data_loss_protect`, you will be ok if
                # we ask for it.
                Sequence(
                    [
                        ExpectMsg("init", if_match=functools.partial(no_feature, [0, 1])),
                        Msg("init", globalfeatures="", features=bitfield(1)),
                    ],
                    enable=not runner.has_option("option_data_loss_protect"),
                ),
                # If you don't support `option_data_loss_protect`, you will error if
                # we require it.
                Sequence(
                    [
                        ExpectMsg("init", if_match=functools.partial(no_feature, [0, 1])),
                        Msg("init", globalfeatures="", features=bitfield(0)),
                        ExpectError(),
                    ],
                    enable=not runner.has_option("option_data_loss_protect"),
                ),
                # If you support `option_data_loss_protect`, you will advertize it odd.
                Sequence(
                    [ExpectMsg("init", if_match=functools.partial(has_feature, [1]))],
                    enable=(runner.has_option("option_data_loss_protect") == "odd"),
                ),
                # If you require `option_data_loss_protect`, you will advertize it even.
                Sequence(
                    [ExpectMsg("init", if_match=functools.partial(has_feature, [0]))],
                    enable=(runner.has_option("option_data_loss_protect") == "even"),
                ),
                # If you don't support `option_anchor_outputs`, you will be ok if
                # we ask for it.
                Sequence(
                    [
                        ExpectMsg("init", if_match=functools.partial(no_feature, [20, 21])),
                        Msg("init", globalfeatures="", features=bitfield(21)),
                    ],
                    enable=not runner.has_option("option_anchor_outputs"),
                ),
                # If you don't support `option_anchor_outputs`, you will error if
                # we require it.
                Sequence(
                    [
                        ExpectMsg("init", if_match=functools.partial(no_feature, [20, 21])),
                        Msg("init", globalfeatures="", features=bitfield(20)),
                        ExpectError(),
                    ],
                    enable=not runner.has_option("option_anchor_outputs"),
                ),
                # If you support `option_anchor_outputs`, you will advertize it odd.
                Sequence(
                    [ExpectMsg("init", if_match=functools.partial(has_feature, [21]))],
                    enable=(runner.has_option("option_anchor_outputs") == "odd"),
                ),
                # If you require `option_anchor_outputs`, you will advertize it even.
                Sequence(
                    [ExpectMsg("init", if_match=functools.partial(has_feature, [20]))],
                    enable=(runner.has_option("option_anchor_outputs") == "even"),
                ),
                # BOLT-a12da24dd0102c170365124782b46d9710950ac1 #9:
                # | Bits  | Name                    | ... | Dependencies
                # ...
                # | 12/13 | `option_static_remotekey` |
                # ...
                # | 20/21 | `option_anchor_outputs` | ... | `option_static_remotekey` |
                # If you support `option_anchor_outputs`, you will
                # advertize option_static_remotekey.
                Sequence(
                    [
                        ExpectMsg(
                            "init", if_match=functools.partial(has_one_feature, [12, 13])
                        )
                    ],
                    enable=(runner.has_option("option_anchor_outputs") is not None),
                ),
                # You should always handle us echoing your own features back!
                [ExpectMsg("init"), Msg("init", globalfeatures=rcvd(), features=rcvd())],
            ),
        ]
    
>       runner.run(test)

tests/test_bolt1-01-init.py:214: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
lnprototest/runner.py:97: in run
    self.start()
lnprototest/clightning/clightning.py:176: in start
    wait_for(lambda: node_ready(self.rpc))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

success = <function Runner.start.<locals>.<lambda> at 0x7f75e8a43ee0>
timeout = 180

    def wait_for(success: typing.Callable, timeout: int = 180) -> None:
        start_time = time.time()
        interval = 0.25
        while not success():
            time_left = start_time + timeout - time.time()
            if time_left <= 0:
>               raise ValueError("Timeout while waiting for {}", success)
E               ValueError: ('Timeout while waiting for {}', <function Runner.start.<locals>.<lambda> at 0x7f75e8a43ee0>)

lnprototest/utils.py:41: ValueError
-------------------------- Captured stderr call --------------------------
DEBUG:lnprototest.runner:Exception with message [Errno 2] No such file or directory: 'bitcoind'
DEBUG:lnprototest.runner:RUN Bitcoind
DEBUG:lnprototest.runner:RUN c-lightning
bitcoin-cli exec failed: Bad file descriptorThe Bitcoin backend died.
======================== short test summary info =========================
FAILED tests/test_bolt1-01-init.py::test_init - ValueError: ('Timeout w...
!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!
================ 1 failed, 1 passed in 180.76s (0:03:00) =================

w0xlt avatar Oct 17 '22 04:10 w0xlt

HI,

This is a lnprototest error, and looks like that you are missing bitcoind from the following line

DEBUG:lnprototest.runner:Exception with message [Errno 2] No such file or directory: 'bitcoind'

vincenzopalazzo avatar Oct 17 '22 07:10 vincenzopalazzo

Hi @vincenzopalazzo Thank you for your help.

So tests require bitcoind in the environment. They ran after I created the symlink in usr/local/bin/.

But a new error appeared. The error is too long to paste it completely here, but the message OSError: [Errno 24] Too many open files is repeated many times.

The last lines are:

OSError: [Errno 24] Too many open files
Error in HTTPServer.serve
Traceback (most recent call last):
  File "/home/nd1/.cache/pypoetry/virtualenvs/cln-meta-project-Y5a7jnq1-py3.9/lib/python3.9/site-packages/cheroot/server.py", line 1823, in serve
    self._connections.run(self.expiration_interval)
  File "/home/nd1/.cache/pypoetry/virtualenvs/cln-meta-project-Y5a7jnq1-py3.9/lib/python3.9/site-packages/cheroot/connections.py", line 203, in run
    self._run(expiration_interval)
  File "/home/nd1/.cache/pypoetry/virtualenvs/cln-meta-project-Y5a7jnq1-py3.9/lib/python3.9/site-packages/cheroot/connections.py", line 246, in _run
    new_conn = self._from_server_socket(self.server.socket)
  File "/home/nd1/.cache/pypoetry/virtualenvs/cln-meta-project-Y5a7jnq1-py3.9/lib/python3.9/site-packages/cheroot/connections.py", line 288, in _from_server_socket
    s, addr = server_socket.accept()
  File "/usr/lib/python3.9/socket.py", line 293, in accept
    fd, addr = self._accept()
OSError: [Errno 24] Too many open files
Traceback (most recent call last):
  File "/home/nd1/.cache/pypoetry/virtualenvs/cln-meta-project-Y5a7jnq1-py3.9/lib/python3.9/site-packages/cheroot/server.py", line 1823, in serve
    self._connections.run(self.expiration_interval)
  File "/home/nd1/.cache/pypoetry/virtualenvs/cln-meta-project-Y5a7jnq1-py3.9/lib/python3.9/site-packages/cheroot/connections.py", line 203, in run
    self._run(expiration_interval)
  File "/home/nd1/.cache/pypoetry/virtualenvs/cln-meta-project-Y5a7jnq1-py3.9/lib/python3.9/site-packages/cheroot/connections.py", line 246, in _run
    new_conn = self._from_server_socket(self.server.socket)
  File "/home/nd1/.cache/pypoetry/virtualenvs/cln-meta-project-Y5a7jnq1-py3.9/lib/python3.9/site-packages/cheroot/connections.py", line 288, in _from_server_socket
    s, addr = server_socket.accept()
  File "/usr/lib/python3.9/socket.py", line 293, in accept
    fd, addr = self._accept()
OSError: [Errno 24] Too many open files
======================== warnings summary ========================
tests/test_connection.py::test_funding_cancel_race
  /home/nd1/.cache/pypoetry/virtualenvs/cln-meta-project-Y5a7jnq1-py3.9/lib/python3.9/site-packages/_pytest/threadexception.py:73: PytestUnhandledThreadExceptionWarning: Exception in thread Thread-3799
  
  Traceback (most recent call last):
    File "/usr/lib/python3.9/threading.py", line 973, in _bootstrap_inner
      self.run()
    File "/usr/lib/python3.9/threading.py", line 910, in run
      self._target(*self._args, **self._kwargs)
    File "/home/nd1/.cache/pypoetry/virtualenvs/cln-meta-project-Y5a7jnq1-py3.9/lib/python3.9/site-packages/cheroot/server.py", line 1849, in start
      self.prepare()
    File "/home/nd1/.cache/pypoetry/virtualenvs/cln-meta-project-Y5a7jnq1-py3.9/lib/python3.9/site-packages/cheroot/server.py", line 1804, in prepare
      raise socket.error(msg)
  OSError: No socket could be created -- (('0.0.0.0', 0): [Errno 24] Too many open files)
  
    warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg))

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
==================== short test summary info =====================
FAILED tests/test_connection.py::test_funding_cancel_race - Tim...
ERROR tests/test_connection.py::test_funding_cancel_race - Valu...
!!!!!!!!!!!!!!!!!!! stopping after 2 failures !!!!!!!!!!!!!!!!!!!!
= 1 failed, 99 passed, 13 skipped, 1 warning, 1 error in 1920.42s (0:32:00) =

w0xlt avatar Oct 17 '22 22:10 w0xlt

Hi @w0xlt,

this looks like a different error from before, it looks that this time it is just a system error, and I think this is the cause https://stackoverflow.com/questions/16526783/python-subprocess-too-many-open-files

Are you running the python test in parallel?

In addition, your tests look safe, there is only some system error that could be a workaround, we have also some flaky tests that annoys us in the CI :/

vincenzopalazzo avatar Oct 17 '22 22:10 vincenzopalazzo

Hi @vincenzopalazzo

I am running make check VALGRIND=0 as per the tutorial. I don´t know why the tests are opening too many open files.

The solutions proposed on stackoverflow might work, but is it expected to change any default OS settings for the tests to work?

w0xlt avatar Oct 19 '22 04:10 w0xlt

The solutions proposed on stackoverflow might work, but is it expected to change any default OS settings for the tests to work?

No, usually no!

vincenzopalazzo avatar Oct 19 '22 08:10 vincenzopalazzo