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

There's no way to set connect timeout for the Esplora backend client #826

Open
rorp opened this issue Dec 24, 2022 · 5 comments
Open

There's no way to set connect timeout for the Esplora backend client #826

rorp opened this issue Dec 24, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@rorp
Copy link

rorp commented Dec 24, 2022

The client often fails to connect over Tor due to timeout. It might be a good idea to make it configurable.

It's possible can set socket timeout though, which is good.

@rorp rorp added the bug Something isn't working label Dec 24, 2022
@notmandatory
Copy link
Member

notmandatory commented Dec 27, 2022

Is the timeout you need different than the timeout field in the EsploraBlockchainConfig ?

@rorp
Copy link
Author

rorp commented Dec 28, 2022

The docs say that the timeout field is in fact the socket timeout and it seems to be different from the connect timeout.

I'm running the Tor example and in most of the cases I get this error, even though I set the timeout field to 120 seconds:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Esplora(Ureq(Transport(Transport { kind: ConnectionFailed, message: Some("Connect error"), url: Some(Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("explorerzydxu5ecjrkwceayqybizmpjjznk5izmitf2modhcusuqlid.onion")), port: None, path: "/testnet/api/scripthash/bb833461984bc2f06978e5e45c86478939c0d122625ec3b0a6a231e3c9b5378e/txs", query: None, fragment: None }), source: Some(Custom { kind: TimedOut, error: "SOCKS proxy: explorerzydxu5ecjrkwceayqybizmpjjznk5izmitf2modhcusuqlid.onion:80 timed out connecting after 29999ms." }), response: None })))', examples/esplora_backend_with_tor.rs:62:54

It fails to connect after 29.999 seconds, so apparently the client uses a different value for the connect timeout.

@rorp
Copy link
Author

rorp commented Dec 28, 2022

Probably, it's related to Socks5 proxy.

@notmandatory
Copy link
Member

Does that mean you can fix it by reconfiguring your Socks5 proxy? If so can you comment on how you do that and close this issue?

@rorp
Copy link
Author

rorp commented Jan 1, 2023

There no timeout config parameter that I'm change in my Socks5 proxy https://github.com/torproject/tor/blob/main/src/config/torrc.sample.in

Sometimes it take a wile to connect via tor, eg:

$ time curl --connect-timeout 1000 -x socks5h://localhost:9050 http://explorerzydxu5ecjrkwceayqybizmpjjznk5izmitf2modhcusuqlid.onion/testnet/api
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>

real    1m21.150s
user    0m0.009s
sys 0m0.016s

It's way more than 29.999 seconds the example uses for some reason, despite I set the timeout to 120 seconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

2 participants