Skip to content

Genesis state download sometimes panics #4738

@michaelsproul

Description

@michaelsproul

Description

We've identified a bug in the downloading of genesis states that is used on Holesky and Chiado (introduced in #4653).

The problem is that we use the reqwest::blocking::Client to download the state, which can panic if called from an async context:

use reqwest::blocking::Client;

info!(
log,
"Downloading genesis state";
"server" => &redacted_url,
"timeout" => ?timeout,
"info" => "this may take some time on testnets with large validator counts"
);
let client = Client::new();

We call it from an async context via genesis_state here:

let genesis_state = genesis_state(&runtime_context, &config, log)?;

and here:

let genesis_state = genesis_state(&runtime_context, &config, log)?;

and here:

let genesis_state = genesis_state(&runtime_context, &config, log)?;

i.e. in all the cases where we are starting the client for the first time: genesis sync, and checkpoint sync from state on-disk or a URL

Version

Lighthouse v4.4.1

Impact

  • Has so far only been observed in debug mode (not --release).
  • Only occurs on first start-up. Once the state is downloaded it is subsequently read from the DB.
  • Can be worked around.

Workaround

Instead of --network holesky, use --testnet-dir pointed to the custom_config_data for Holesky.

Steps to resolve

  • Option 1: wrap the calls in spawn_blocking or similar.
  • Option 2: use the async reqwest client in Eth2NetworkConfig and propagate the async-ness (this might be painful).

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingv4.5.0ETA Q4 2023

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions