tezos-reward-distributor
tezos-reward-distributor copied to clipboard
json from 500 errors from rpcs is parsed
Describe the bug 500 errors from tezos node rpcs are not actually retried:
https://github.com/tezos-reward-distributor-organization/tezos-reward-distributor/blob/d718062fd8b969bd4d6f27cfe578cd309217a2b4/src/rpc/rpc_reward_api.py#L406
This says "server side errors 5xx can pass for a retry". But a retry is not what happens -- the body of the 5xx response is returned.
To Reproduce
I discovered this while working on https://github.com/tezos-reward-distributor-organization/tezos-reward-distributor/pull/596 -- but you could just point tezos_node_addr to an endpoint that returns 500 for queries to e.g. /chains/main/blocks/\d+/context/selected_snapshot?cycle=\d+
.
Expected behavior I would expect these queries to either cleanly fail, or to get retried (and then cleanly fail). But instead, the 500 response is parsed as json (which, in the case of errors from tezos, it is), and returned to the caller, causing an unclean error later on.
When was this completed? I don't see it in !581.
Did I misinterpret something? I thought you solved it in #596 and it was merged into #581 by Nicolas and I just merged it into master?
ahhhh, you discovered it in #596
sorry, reopening
Hey there @novalis, I tried to reproduce this issue, but may be missing something here. Is it possible you were getting a 4xx error? If I ensure it's a 5xx error it indeed does retry. Can you confirm for me?
I am no longer working on Tezos, so I am not set up to reproduce. But the code appears the same: 500 errors are not caught by the if statement, and are in fact parsed as JSON.