interface_bitcoin_cli.py fails intermittently #18684

issue MarcoFalke openend this issue on April 17, 2020
  1. MarcoFalke commented at 2:28 pm on April 17, 2020: member

    https://travis-ci.org/github/bitcoin/bitcoin/jobs/676156661#L6349

    0 test  2020-04-17T14:09:31.865000Z TestFramework (ERROR): 
    1  Called Process failed with 'error: Could not locate RPC credentials. No authentication cookie could be found, and RPC password is not set.  See -rpcpassword and -stdinrpcpass.  Configuration file: (/home/travis/build/bitcoin/bitcoin/ci/scratch/test_runner/test_runner_₿_🏃_20200417_132645/interface_bitcoin_cli_109/node0/bitcoin.conf) 
    

    cc @jonatack

  2. MarcoFalke added the label Bug on Apr 17, 2020
  3. MarcoFalke commented at 2:51 pm on April 17, 2020: member
    The failure is in the line with -rpcwait, you probably need wait_for_rpc_connection
  4. brakmic commented at 4:10 pm on April 17, 2020: contributor
  5. jonatack commented at 4:52 pm on April 17, 2020: member

    Same problem with my PR: https://travis-ci.org/github/bitcoin/bitcoin/jobs/676136137

    Are you able to reproduce locally? Even valgrind test/functional/interface_bitcoin_cli.py -l debug runs fine for me.

  6. brakmic commented at 4:53 pm on April 17, 2020: contributor

    Same problem with my PR: https://travis-ci.org/github/bitcoin/bitcoin/jobs/676136137

    Are you able to reproduce locally?

    Sadly, I’m not. All test pass, no errors whatsoever.

  7. brakmic commented at 5:01 pm on April 17, 2020: contributor

    @jonatack

    However, there’s one thing I just did that provoked the same error:

    I changed setup_clean_chain to False.

    0self.setup_clean_chain = False
    

    Then I got this:

     0./test/functional/interface_bitcoin_cli.py                                          (3s 428ms)  
     12020-04-17T16:59:26.097000Z TestFramework (INFO): Initializing test directory /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_6h67eta3
     22020-04-17T16:59:28.940000Z TestFramework (INFO): Compare responses from getwalletinfo RPC and `bitcoin-cli getwalletinfo`
     32020-04-17T16:59:29.002000Z TestFramework (INFO): Compare responses from getblockchaininfo RPC and `bitcoin-cli getblockchaininfo`
     42020-04-17T16:59:29.024000Z TestFramework (INFO): Test -stdinrpcpass option
     52020-04-17T16:59:29.043000Z TestFramework (ERROR): Assertion failed
     6Traceback (most recent call last):
     7  File "/Users/brakmic/projects/bitcoin-dev/btc-global-ctx/test/functional/test_framework/test_framework.py", line 112, in main
     8    self.run_test()
     9  File "./test/functional/interface_bitcoin_cli.py", line 45, in run_test
    10    assert_equal(BLOCKS, self.nodes[0].cli('-rpcuser=%s' % user, '-stdinrpcpass', input=password).getblockcount())
    11  File "/Users/brakmic/projects/bitcoin-dev/btc-global-ctx/test/functional/test_framework/util.py", line 46, in assert_equal
    12    raise AssertionError("not(%s)" % " == ".join(str(arg) for arg in (thing1, thing2) + args))
    13AssertionError: not(101 == 301)
    142020-04-17T16:59:29.123000Z TestFramework (INFO): Stopping nodes
    152020-04-17T16:59:29.584000Z TestFramework (WARNING): Not cleaning up dir /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_6h67eta3
    162020-04-17T16:59:29.585000Z TestFramework (ERROR): Test failed. Test logging available at /var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_6h67eta3/test_framework.log
    172020-04-17T16:59:29.586000Z TestFramework (ERROR): Hint: Call /Users/brakmic/projects/bitcoin-dev/btc-global-ctx/test/functional/combine_logs.py '/var/folders/7q/4ffytzk562dd2ky4bfg9_w7h0000gn/T/bitcoin_func_test_6h67eta3' to consolidate all logs
    

    Which could mean that this fails when it runs on a touched chain.

    –EDIT: forgot to mention that this is only a speculation of mine.

  8. sipa deleted a comment on Apr 17, 2020
  9. jonatack commented at 6:43 pm on April 17, 2020: member

    The issue isn’t from running too slowly: I added timeouts of up to 90 seconds before and after the call and the test doesn’t fail.

    0         # Verify failure without -rpcwait.
    1         assert_raises_process_error(1, "Could not connect to the server", self.nodes[0].cli('getblockcount').echo)
    2         # Verify success using -rpcwait.
    3+        import time; time.sleep(90)
    4         assert_equal(BLOCKS, self.nodes[0].cli('-rpcwait', 'getblockcount').send_cli())
    5+        time.sleep(90)
    6         self.nodes[0].wait_for_rpc_connection()
    

    AFAICT it’s failing because failedToGetAuthCookie is set to true at bitcoin-cli.cpp::L352 and triggering the throw at bitcoin-cli.cpp::L398.

  10. brakmic commented at 6:50 pm on April 17, 2020: contributor

    The issue isn’t from running too slowly: I added timeouts of up to 90 seconds before and after the call and the test doesn’t fail.

    0         # Verify failure without -rpcwait.
    1         assert_raises_process_error(1, "Could not connect to the server", self.nodes[0].cli('getblockcount').echo)
    2         # Verify success using -rpcwait.
    3+        import time; time.sleep(90)
    4         assert_equal(BLOCKS, self.nodes[0].cli('-rpcwait', 'getblockcount').send_cli())
    5+        time.sleep(90)
    6         self.nodes[0].wait_for_rpc_connection()
    

    AFAICT it’s failing because failedToGetAuthCookie is set to true at bitcoin-cli.cpp::L352 and triggering the throw at bitcoin-cli.cpp::L398.

    Interesting!

    Maybe in future, if my PR regarding factor option for timeouts gets accepted, we could add such an option for this test as well?

  11. jonatack commented at 6:57 pm on April 17, 2020: member

    Tempted to propose something like this, as I can’t reproduce the failure locally:

    0         # Verify success using -rpcwait.
    1+        time.sleep(1)
    2         assert_equal(BLOCKS, self.nodes[0].cli('-rpcwait', 'getblockcount').send_cli())
    
  12. brakmic commented at 7:01 pm on April 17, 2020: contributor

    Tempted to propose something like this, as I can’t reproduce the failure locally:

    0         # Verify success using -rpcwait.
    1+        time.sleep(1)
    2         assert_equal(BLOCKS, self.nodes[0].cli('-rpcwait', 'getblockcount').send_cli())
    

    Well, I am not a python expert, but wouldn’t be better to have some kind of async/wait or JS-like promise function (not sure what’s the proper, pythonic way of doing such things). thread.sleep feels kinda hard, like a stop sign.

  13. MarcoFalke closed this on Apr 20, 2020

  14. sidhujag referenced this in commit 767b73a827 on Apr 20, 2020
  15. MarcoFalke locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-09-29 07:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me