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

bug: fetcher infinite loop #873

Open
samlaf opened this issue Dec 17, 2024 · 1 comment
Open

bug: fetcher infinite loop #873

samlaf opened this issue Dec 17, 2024 · 1 comment
Labels
K-bug Kind: bug

Comments

@samlaf
Copy link
Contributor

samlaf commented Dec 17, 2024

Right now the fetcher naively retries fetching until it succeeds:

// Use a loop to keep retrying the prefetch as long as the key is not found
while preimage.is_none() && self.last_hint.is_some() {
    let hint = self.last_hint.as_ref().expect("Cannot be None");

    if let Err(e) = self.prefetch(hint).await {
        error!(target: "fetcher", "Failed to prefetch hint: {e}");
        warn!(target: "fetcher", "Retrying hint fetch: {hint}");
        continue;
    }

    let kv_lock = self.kv_store.read().await;
    preimage = kv_lock.get(key);
}

The error strategy (warning and continuing to try) doesn't separate temporary errors from unrecoverable errors, such as 404 type of errors where a hint is invalid:

if hint_data.len() != 32 {
    anyhow::bail!("Invalid hint data length: {}", hint_data.len());
}

So the fetcher will just fall into an infinite for loop.

@clabby
Copy link
Collaborator

clabby commented Jan 10, 2025

Thanks. The infinite re-try is actually intentional (when it comes to RPC errors), but it would be a good idea for us to attempt to delineate between truly unrecoverable errors and RPC flakes.

Infinitely retrying is sort-of-better for production deployments (assuming we can't be certain if an error is unrecoverable), where RPC flakes are actually pretty common & runs of the proof have timeouts / alerts on long runs.

@emhane emhane added the K-bug Kind: bug label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
K-bug Kind: bug
Projects
Status: Backlog
Development

No branches or pull requests

3 participants