You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the report and good catch. I havent been able to reproduce this myself though during my testing, so out of curiosity was there any specific conditions in which a panic would happen?
Because of (3), this is called for a second time and will panic.
More info:
gloo-timers panic if an expired TimeoutFuture is reused (code).
futures-timer's native implementation does not panic, but they didn't apply this behavior for WASM (code)
The following fixes the issue in libp2p-ping, however we need to recheck all the places that futures_timer::Delay is used in libp2p to make sure that no other places are affected.
diff --git a/protocols/ping/src/handler.rs b/protocols/ping/src/handler.rs
index b9bd25c52..af7a55a13 100644
--- a/protocols/ping/src/handler.rs+++ b/protocols/ping/src/handler.rs@@ -183,6 +183,7 @@ impl Handler {
>,
) {
self.outbound = None; // Request a new substream on the next `poll`.
+ self.interval.reset(Duration::new(0, 0));
let error = match error {
StreamUpgradeError::NegotiationFailed => {
Thanks for the info. I will see what i can do on my end to reproduce it just out of my curiosity. In the meantime, maybe we should work on getting a patch done here in libp2p-ping since it might be a while before somebody review your fix in futures-timer (going based on the previous history there).
Activity
dariusc93 commentedon Jun 4, 2024
Thanks for the report and good catch. I havent been able to reproduce this myself though during my testing, so out of curiosity was there any specific conditions in which a panic would happen?
oblique commentedon Jun 4, 2024
It is a bit hard to reproduce it. In our case sometimes takes 30 minute to reproduce. The following flow triggers it:
self.outboundis reset.More info:
gloo-timerspanic if an expiredTimeoutFutureis reused (code).futures-timer's native implementation does not panic, but they didn't apply this behavior for WASM (code)The following fixes the issue in
libp2p-ping, however we need to recheck all the places thatfutures_timer::Delayis used in libp2p to make sure that no other places are affected.dariusc93 commentedon Jun 4, 2024
Thanks for the info. I will see what i can do on my end to reproduce it just out of my curiosity. In the meantime, maybe we should work on getting a patch done here in
libp2p-pingsince it might be a while before somebody review your fix infutures-timer(going based on the previous history there).fix(ping): Fixes panic in WASM caused by retrying on dail errors
oblique commentedon Jun 6, 2024
I created a repository with reproduction: https://github.com/oblique/libp2p-issue-5442
Please read
README.mdfor more info.fix(ping): Fixes panic in WASM caused by retrying on dail errors
fix(ping): Fix panic in WASM caused by retrying on dial upgrade errors
fix(ping): Fix panic in WASM caused by retrying on dial upgrade errors
fix(ping): Fix panic in WASM caused by retrying on dial upgrade errors