Skip to content

CI: blockchain::esplora::bdk_blockchain_tests::test_sync_stop_gap_20 occationally fails #650

Closed

Description

@evanlinjin

Describe the bug

CI: blockchain::esplora::bdk_blockchain_tests::test_sync_stop_gap_20 occationally fails.

The command that fails

$ cargo test --no-default-features --features test-esplora,use-esplora-ureq,verify esplora::bdk_blockchain_tests

Occurences

Activity

  1. added
    bug
    on Jul 2, 2022
  2. rajarshimaitra commented on Jul 3, 2022

    @rajarshimaitra
    Contributor

    I have been witnessing few occasional failures in blockchain tests in my local too.. Seems like some kind of resource blocking thingy happening somewhere?? I was seeing "resource unavailable" errors few days ago when running blockchian tests all together.. Which I can't seem to reproduce anymore.. Could be something related??

    From the error message it seems something got timed out while waiting for some stuffs..

  3. evanlinjin commented on Jul 3, 2022

    @evanlinjin
    ContributorAuthor

    I have been witnessing few occasional failures in blockchain tests in my local too.. Seems like some kind of resource blocking thingy happening somewhere?? I was seeing "resource unavailable" errors few days ago when running blockchian tests all together.. Which I can't seem to reproduce anymore.. Could be something related??

    From the error message it seems something got timed out while waiting for some stuffs..

    Same here. Would it make sense to implement some retry logic/exponential backoff?

    We can keep track of the errors and where they occur here.

  4. rajarshimaitra commented on Jul 4, 2022

    @rajarshimaitra
    Contributor

    Same here. Would it make sense to implement some retry logic/exponential backoff?

    We do have an exponential pole at electrum calls

    fn exponential_backoff_poll<T, F>(mut poll: F) -> T
    where
    F: FnMut() -> Option<T>,
    {
    let mut delay = Duration::from_millis(64);
    loop {
    match poll() {
    Some(data) => break data,
    None if delay.as_millis() < 512 => delay = delay.mul_f32(2.0),
    None => {}
    }
    std::thread::sleep(delay);
    }
    }

    To me it seems for some reason the electrum calls isn't returning and some resources are not being free??

    The error seems to disappear in single test runs.. Only when I run all the blockchian tests together..

  5. afilini commented on Jul 4, 2022

    @afilini
    Contributor

    This looks like a bug in electrsd:

    [2022-07-02T18:30:55Z ERROR electrsd] early exit with: ExitStatus(unix_wait_status(134))

    Maybe it doesn't handle too much load well. I'll see if I can somehow attach a debugger and reproduce.

  6. evanlinjin commented on Jul 4, 2022

    @evanlinjin
    ContributorAuthor

    This is a one-off failure, not sure if it is related.

    failures:
    
    ---- blockchain::esplora::bdk_blockchain_tests::test_double_spend stdout ----
    thread 'blockchain::esplora::bdk_blockchain_tests::test_double_spend' panicked at 'called `Result::unwrap()` on an `Err` value: JSON(Error("expected value", line: 1, column: 1))', src/testutils/blockchain_tests.rs:65:56
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    
    
    failures:
        blockchain::esplora::bdk_blockchain_tests::test_double_spend
    
  7. afilini commented on Jul 4, 2022

    @afilini
    Contributor

    Maybe it's related to this? bitcoindevkit/rust-electrum-client#67

  8. evanlinjin commented on Jul 4, 2022

    @evanlinjin
    ContributorAuthor
    failures:
    
    ---- blockchain::esplora::bdk_blockchain_tests::test_sync_address_index_should_not_decrement stdout ----
    thread 'blockchain::esplora::bdk_blockchain_tests::test_sync_address_index_should_not_decrement' panicked at 'called `Result::unwrap()` on an `Err` value: EarlyExit(ExitStatus(unix_wait_status(134)))', src/testutils/blockchain_tests.rs:36:75
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    
    
    failures:
        blockchain::esplora::bdk_blockchain_tests::test_sync_address_index_should_not_decrement
    
    test result: FAILED. 256 passed; 1 failed; 5 ignored; 0 measured; 0 filtered out; finished in 6.41s
    
  9. evanlinjin commented on Jul 5, 2022

    @evanlinjin
    ContributorAuthor
     failures:
    error: test failed, to rerun pass '--lib'
    ---- blockchain::esplora::bdk_blockchain_tests::test_tx_chain stdout ----
    thread 'blockchain::esplora::bdk_blockchain_tests::test_tx_chain' panicked at 'called `Result::unwrap()` on an `Err` value: EarlyExit(ExitStatus(unix_wait_status(134)))', src/testutils/blockchain_tests.rs:36:75
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    failures:
        blockchain::esplora::bdk_blockchain_tests::test_tx_chain
    
  10. evanlinjin commented on Jul 12, 2022

    @evanlinjin
    ContributorAuthor
    ---- blockchain::electrum::test::bdk_blockchain_tests::test_sync_bump_fee_basic stdout ----
    thread 'blockchain::electrum::test::bdk_blockchain_tests::test_sync_bump_fee_basic' panicked at 'called `Result::unwrap()` on an `Err` value: IOError(Os { code: 104, kind: ConnectionReset, message: "Connection reset by peer" })', src/testutils/blockchain_tests.rs:65:56
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    
  11. rajarshimaitra commented on Jul 13, 2022

    @rajarshimaitra
    Contributor

    Yes.. I have been seeing this one in my local..

  12. evanlinjin commented on Jul 13, 2022

    @evanlinjin
    ContributorAuthor

    Yes.. I have been seeing this one in my local..

    I mean if the error states "Resource TEMPORARILY unavailable", I think we can safely wrap the calls with exponential back-off logic. I did see a function in the tests for exponential back-off, so maybe we can reuse that.

  13. afilini commented on Jul 14, 2022

    @afilini
    Contributor

    My guess: the tcp send buffer gets filled up because core can't process all those requests at once. Increasing the number of threads would probably help.

    Source https://linux.die.net/man/2/send:

    When the message does not fit into the send buffer of the socket, send() normally blocks, unless the socket has been placed in nonblocking I/O mode. In nonblocking mode it would fail with the error EAGAIN or EWOULDBLOCK in this case

  14. added a commit that references this issue on Sep 1, 2022
  15. notmandatory commented on Sep 10, 2022

    @notmandatory
    Contributor

    I ran into this issue testing bitcoindevkit/bdk-cli#102 with the new regtest-bitcoin feature which starts up a local bitcoind and connects to it via the RPC client, but the error only seemed to happen on my MacOS system, the CI tests all pass on Ubuntu Linux. While debugging I noticed in the bitcoind logs a list of RPC requests to "Update existing descriptor: raw(...)" seems to be the default 100 address look ahead, so I think the requests are all getting successfully delivered but the RPC client connection disconnects always after 5 seconds and throws the SocketError "Resource temporarily unavailable". I'll try making the bitcoind server responded faster (as @afilini suggested with more threads), and separately see if I can make the RPC client timeout longer and report back.

  16. notmandatory commented on Sep 10, 2022

    @notmandatory
    Contributor

    I re-tried my test with more rpcthreads set on bitcoind with conf set to via "-rpcthread=", I tired 20 and 50, didn't seem to make a difference. I haven't find a way yet to change the RPC call socket timeout.

  17. notmandatory commented on Sep 10, 2022

    @notmandatory
    Contributor

    Probably best to disregard my above RPC problems since the title of this issue is really about esplora. I'll open a new issue for my RPC macos problem.

  18. notmandatory commented on Mar 2, 2023

    @notmandatory
    Contributor

    Could this issue be related to the default number for file descriptors running out? This is mentioned for core here: JSON-RPC-interface limitations.

  19. rajarshimaitra commented on Mar 26, 2023

    @rajarshimaitra
    Contributor

    As per https://docs.oracle.com/cd/E19476-01/821-0505/file-descriptor-requirements.html, the default limit for file descriptors per process is 1024. I am not fully sure, but I think we are not hitting that many RPC requests.

    Another pointer from LDK team was, it should just redo the call again if it hits the error. lightningdevkit/rust-lightning#2033 (comment)

    I will try with this on the new RPC example and report back..

  20. notmandatory commented on Mar 20, 2025

    @notmandatory
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions