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

Bugged timeout in DiscoverSched::getNetnames #609

Open
Zalewa opened this issue Dec 5, 2022 · 0 comments
Open

Bugged timeout in DiscoverSched::getNetnames #609

Zalewa opened this issue Dec 5, 2022 · 0 comments

Comments

@Zalewa
Copy link
Contributor

Zalewa commented Dec 5, 2022

There are several issues with the timeout argument in DiscoverSched::getNetnames:

  1. Mixed units. The docstring and the usage indicates that the timeout is expressed in milliseconds, but then its compared in min() against seconds
        /* Wait at least two seconds to give all schedulers a chance to answer
           (unless that'd be longer than the timeout).*/
        time_t timeout_time = time(nullptr) + min(2 + 1, timeout); // <-- timeout is in ms, time() is in seconds
  1. The timeout of the do/while loop is based on a wall clock instead of a monotonic clock. It's susceptible to wall clock changes (ntpdate).
  2. The granularity of the do/while loop has a 1 second precision because it's based on time(). The timeout is an integer, divided by 1000. The only case where this method is called, it's called with timeout 200, meaning that the timeout is effectively 0 seconds. This means that this do/while loop always runs exactly once.
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

No branches or pull requests

1 participant