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

Implement a 'waiting mode' for cases where RPC calls are not functioning correctly? #699

Open
AdamISZ opened this issue Oct 8, 2020 · 6 comments

Comments

@AdamISZ
Copy link
Member

AdamISZ commented Oct 8, 2020

See #673 (comment) as a summary of that thread as a whole, the commit which closed that thread did only the "easy" thing of shutting down, and the issue is rather tricky.

I want to strongly emphasize again, that a simple flakiness of network connection should already be handled by extensive Exception catching as well as multiple retries within jsonrpc.py already, this is only for special/unexpected failures.

@AdamISZ
Copy link
Member Author

AdamISZ commented Aug 10, 2021

Indeed, painstaking efforts were made some years ago to try to assure that all error conditions were handled, including timeouts. See:

request = {"method": method, "params": params, "id": currentId}
#query can fail from keepalive timeout; keep retrying if it does, up
#to a reasonable limit, then raise (failure to access blockchain
#is a critical failure). Note that a real failure to connect (e.g.
#wrong port) is raised in queryHTTP directly.
response_received = False
for i in range(100):
response = self.queryHTTP(request)
if response != "CONNFAILURE":
response_received = True
break

So if that isn't doing what it's intended to do, we, I guess, have a bug we need to fix (or handle an unanticipated case, let's say).

I guess this is one of those things that's significantly harder to do because it has to be reproduced first. Can you get something reproducible (tough one, but if you can that might be our best shot).

@AdamISZ
Copy link
Member Author

AdamISZ commented Aug 10, 2021

Your suggested fix of keeping the retry in blockchaininterface.py certainly doesn't look dumb, but I agree it'd need some careful thought. My first issue is I don't know why the retry in jsonrpc.py itself is not working.

@AdamISZ
Copy link
Member Author

AdamISZ commented Aug 10, 2021

Oh I see. That CONNFAILURE check is only the case of BadStatusLine. So doubtless the "not responding before a timeout" return is different. Maybe we can just check what happens when the other end doesn't respond and put that in jsonrpc.py.

When I originally made this issue I was just vaguely assuming we had the 'connection timed out' case covered, because we had addressed so many cases. But it looks like, maybe not.

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

No branches or pull requests

2 participants
@AdamISZ and others