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

Confusing error code when simple_http times out #24

Open
stevenroose opened this issue Dec 6, 2024 · 5 comments
Open

Confusing error code when simple_http times out #24

stevenroose opened this issue Dec 6, 2024 · 5 comments

Comments

@stevenroose
Copy link

Arguably we're probably using a version of the jsonrpc crate that is older than this repo. Not sure where else to bring this up, the issue might persist.

We had some of our RPC calls timeout and the error we were getting was

JsonRpc(Transport(SocketError(Os { code: 35, kind: WouldBlock, message: "Resource temporarily unavailable" })))

That's honestly a very confusing wording for a timeout. We spent quite a long time thinking there was some TCP issue with bitcoind binding to the port or us making TCP connections to the TCP port until we noticed they were actually just timing out.

I checked the code and it seems this error comes straight out of stdlib's TcpStream type, which is kinda unfortunate.

@tcharding
Copy link
Member

Yeah man this is a fair place to raise the issue, thanks. I can definitely look into it. What were you hoping see?

we're probably using a version of the jsonrpc crate that is older than this repo.

Any reason you can't use the latest version of jsonrpc?

@apoelstra
Copy link
Member

What were you hoping see?

Ideally there'd be some indication that the node just timed out. This happens often when hitting the RPC hard during IBD.

Unfortunately the symptom of this is that Core simply won't respond at all for several seconds until the TCP pipe dies. So it's a bit hard for us to detect this case and provide a more useful message.

@tcharding
Copy link
Member

If one knows they are hitting Core on the local network there is no reason for a delay right, so we could time each request and if it takes a second just return saying "timeout".

@apoelstra
Copy link
Member

Yeah, adding our own timer is not a bad idea.

We should also make sure that this is configurable -- I believe it is in rust-jsonrpc (I use this in my wallet software, which needs a 10-second timeout during blockchain scanning if the node is otherwise busy).

@apoelstra
Copy link
Member

BTW I just synced my wallet and the timeout errors I get look like

Caused by:
    0: getting hash of block 856785
    1: transport error: MINREQ error: the timeout of the request was reached
    2: MINREQ error: the timeout of the request was reached
    3: the timeout of the request was reached
    4: the timeout of the request was reached

I wonder if the Display impl is already ok, and it's just hte Debug impl which is hard to understand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants