-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[providers] Fallback provider hangs #2030
Comments
Seems its happening due to the |
We noticed the same issue |
Can you try using the const provider = new FallbackProvider([
{ provider: provider1, stallTimeout: 1000 },
{ provider: provider2, stallTimeout: 1500 }
]) |
For me, problem was in |
How i can reproduce, and my explanation for I have 6 JSON RPC providers
After shuffling
Iterations (simplified), actually they depend on each provider states (blockNumber) in current moment.
With contract events subscribing, all next getLogs (that raised by polling interval and don't wait previous to complete) calls will stuck without returning result / error. Update
Full logs from one of the tests |
Issue exist. If one of the providers on full hang 404, other fallback providers dont do the job. Other providers are up and running and could deliver result. My setup expect is to run request to 3 backends and get the result with the same weight. If any of those delivers, positive result should be returned. let provider1=new ethers.providers.StaticJsonRpcProvider(prov[0]) let provider_fallback=new ethers.providers.FallbackProvider([ Error: |
Found 1 more stuck (not actually relative to fallback provider), but to specific logic in if (maxAge > 0) {
// While there are pending internal block requests...
while (this._internalBlockNumber) {
// ..."remember" which fetch we started with
const internalBlockNumber = this._internalBlockNumber;
try {
// Check the result is not too stale
const result = await internalBlockNumber;
if ((getTime() - result.respTime) <= maxAge) {
return result.blockNumber;
}
// Too old; fetch a new value
break;
} catch(error) {
// The fetch rejected; if we are the first to get the
// rejection, drop through so we replace it with a new
// fetch; all others blocked will then get that fetch
// which won't match the one they "remembered" and loop
if (this._internalBlockNumber === internalBlockNumber) {
break;
}
}
}
} Two problems which are reproducible (i reproduced this by sendTransaction and using FallbackProvider, that currently waits all providers to complete, and after it returns any success). if (method === "sendTransaction") {
const results: Array<string | Error> = await Promise.all(this.providerConfigs.map((c) => { sendTransaction is hangs on several seconds/minutes/hours (according to count of Problems:
1st problem details.
|
I'm having this very same issue, the NETWORK_ERROR is being raised as a result from calling a contract function instead from withing the provider, there should be some kind try_catch in between so the FallbackProvider could catch this and switch to a different provider. This is my FallBackProvider setup:
A quick update with this code I was able to avoid the NETWORK_ERROR but now I'm having this: Error: failed to meet quorum (method="getBlockNumber", params={}, results=[{"weight":5,"start":1639593840435,"result":13503917},{"weight":4,"start":1639593840435,"result":13503917},{"weight":3,"start":1639593841435,"result":13503917},{"weight":1,"start":1639593841435,"result":13503917},{"weight":2,"start":1639593841435,"result":13503917}], provider="[object Object]", code=SERVER_ERROR, version=providers/5.5.1 |
I am also running into this issue. I am hosting two of my own nodes, and I can replicate this issue by rerouting the destination provider url for one of the nodes using an IP route or a firewall rule. Is it safe to say we should avoid this feature for now in favor of a |
Any updates on this? I'm having the same issue. Also, more detailed information overall (and perhaps even a quality recovery mechanism) would be nice. I receive the call that timed out (e.g. Timing out (when you have 3 endpoints configured) then receiving |
I am facing the same problem. Seems like right now it's better to just stick to one solid provider instead of using 4 fallback providers that include a black sheep that regularly times out/hangs... Just one provider giving me more uptime. |
Still occurs on ethers@v6. Sadly, this is a huge blocker which makes all of us create custom solutions for fallbacks. |
Describe the bug
When using a
FallbackProvider
if you have an RPC that hangs, the entire request will hang even if other RPCs are returning quickly without issue.Important usage note: this issue was reproduced with a quorum of 1 (either because there are only 2 provider URLs used, or
quorum
is explicitly set to 1.Reproduction steps
Environment:
Reproducible in a node repl, difficult part is finding a URL that hangs! Using
"ethers": "^5.4.6"
The text was updated successfully, but these errors were encountered: