-
Notifications
You must be signed in to change notification settings - Fork 283
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] GethInstance
dropping connections with the underlying node
#2091
Comments
do you have any logs of the gethinstance? it could be useful to launch the geth instance separately and take a look at the output |
No, but I will find a way to log its output. |
Ok, I went for this, and pulled the Now, surprise: if I pull out that stream (and so, I consume it) it doesn't fail, indeed the logfile does not have a single |
Ok, I was able to reproduce it. The 1st test ( thread 'tests::test_gethinstance' panicked at src/main.rs:46:18:
called `Result::unwrap()` on an `Err` value: ErrorResp(ErrorPayload { code: -32002, message: "request timed out", data: None }) The 2nd test ( Here the snippet: #[cfg(test)]
mod tests {
use tracing::info;
use std::{
io::{BufRead, BufReader},
time::Duration,
};
use alloy::{
node_bindings::Geth,
providers::{Provider, ProviderBuilder},
};
use tracing_test::traced_test;
#[tokio::test]
#[traced_test]
async fn test_gethinstance() {
// Create GethInstance
info!("Create geth instance");
let geth = Geth::new().dev().block_time(1).spawn();
// Get provider
let provider = ProviderBuilder::new().on_http(geth.endpoint_url());
info!("Check connection with `net_listening`");
let resp = provider
.raw_request::<_, bool>("net_listening".into(), ())
.await
.unwrap();
assert!(resp);
info!("Simulate seed generation");
tokio::time::sleep(Duration::from_secs(20)).await;
// Interact with node by checking each time `net_listening`
for i in 0..=999 {
info!("Attempt #{i}");
let resp = provider
.raw_request::<_, bool>("net_listening".into(), ())
.await
.unwrap();
assert!(resp);
}
}
#[tokio::test]
#[traced_test]
async fn test_gethinstance_stderr() {
// Create GethInstance
info!("Create geth instance");
let mut geth = Geth::new().dev().block_time(1).spawn();
// Get provider
let provider = ProviderBuilder::new().on_http(geth.endpoint_url());
info!("Check connection with `net_listening`");
let resp = provider
.raw_request::<_, bool>("net_listening".into(), ())
.await
.unwrap();
assert!(resp);
info!("Simulate seed generation");
tokio::time::sleep(Duration::from_secs(20)).await;
info!("Pulling out stderr from GethInstance");
let mut stderr = geth.stderr().unwrap();
let _ = std::thread::spawn(move || {
let mut buf = String::new();
let mut reader = BufReader::new(&mut stderr);
loop {
buf.clear();
reader.read_line(&mut buf).unwrap();
}
});
// Interact with node by checking each time `net_listening`
for i in 0..=999 {
info!("Attempt #{i}");
let resp = provider
.raw_request::<_, bool>("net_listening".into(), ())
.await
.unwrap();
assert!(resp);
}
}
} |
ah I think this is the same problem as #1985 |
Component
node-bindings
What version of Alloy are you on?
v0.11.1
Operating System
Linux
Describe the bug
Description
I have a test suite which needs to setup 2 sets of wallets (each set has both EOAs and Smart Contract Accounts) after the generation of their related seeds.
The 1st set of wallets is created in a certain amount of time
X
, and if the seed is related to the a Smart Contract Account then the deployment through aGethInstance
is done right after the generation it.The 2nd set of wallets requires an amount of time
Y > X
, since the seed generation process needs more computation time, but the procedure then follows the same logic ad the previous case (if SCA, deploy).These sets of wallets are generated (and eventually deployed) sequentially, first going with set
1
and then with2
.While for set
1
everything goes smoothly, for set2
it always happens that when I reach the point in which I need to deploy a SCA I got the following error message from the underlyingGethInstance
:This error comes from checking the status of the underlying
GethInstance
by sending a raw request to it for thenet_listening
RPC method. Basically, I create the connection to theGethInstance
and I do a first check as mentioned, then I start generating the seeds (which requires ~20s) and then I do further checks withnet_listening
each time I need to deploy a SCA.I ran the same test flow with both an
AnvilInstance
and aGethInstance
, but for Anvil it always goes to completion while for Geth doesn't.More over, I have an implementation of
geth
command binding (let's call itGethD
) that tears up the geth instance and peforms the operations mentioned before, and also with this one it doesn't fail at all.To me, it looks like the first connection to the
GethInstance
works good during the init phase while after waiting for the process of generating the seeds the connection drops for some reason and so that error is returned.Details
For all the 3 cases mentioned (
AnvilInstance
,GethInstance
and my ownGethD
binding) I have the following setup:Dev
modechain_id
= 1337 (ofc)block_time
= 1sThe text was updated successfully, but these errors were encountered: