Skip to content

Conversation

@andrewjstone
Copy link
Contributor

[Properly use tokio::time::{pause,advance,resume};

Fixes #9377

Properly use tokio::time::{pause,advance,resume};
@sunshowers
Copy link
Contributor

Hmm, so in theory Tokio's pausable timer stuff has auto-advance built into it. Is it even necessary to manage timers manually?

@jgallagher
Copy link
Contributor

Hmm, so in theory Tokio's pausable timer stuff has auto-advance built into it. Is it even necessary to manage timers manually?

IIUC, I think it is. The test wants to skip ahead by RECONNECT_TIME, hence the pause/advance/resume bit. But it can't only use auto-advancing timers, because that breaks the wait_for_condition checks that are willing to wait up to 10 seconds for various networking activity to complete. If tokio's clock is paused and it autoadvances, each wait_for_condition iteration auto-advances immediately, which doesn't give enough real clock time for the networking bits to do what they're supposed to do.

@andrewjstone
Copy link
Contributor Author

andrewjstone commented Nov 11, 2025

If tokio's clock is paused and it autoadvances, each wait_for_condition iteration auto-advances immediately, which doesn't give enough real clock time for the networking bits to do what they're supposed to do.

At least on Linux, it's even worse than that. If I comment out all the existing stuff and just call tokio::time::pause() before the last wait_for_condition the test hangs. This is essentially what was happening before. Note that this is using std::time::Instant in wait_for_condition.

If I switch to using tokio::time::Instant in wait_for_condition, it does what John says and times out too quickly.

Copy link
Contributor

@sunshowers sunshowers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, thanks!

@andrewjstone andrewjstone merged commit cc26e3e into main Nov 11, 2025
16 checks passed
@andrewjstone andrewjstone deleted the fix-tq-test-full-mesh-connectivity branch November 11, 2025 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test failed in CI: trust-quorum task::tests::full_mesh_connectivity

4 participants