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

wait_for_network waits longer than two minutes #354

Open
jrha opened this issue Jan 16, 2025 · 0 comments
Open

wait_for_network waits longer than two minutes #354

jrha opened this issue Jan 16, 2025 · 0 comments

Comments

@jrha
Copy link
Member

jrha commented Jan 16, 2025

The current code appears to assume that nslookup fails instantly, however the default behaviour is to make three requests, each with a timeout of 5 seconds, so a host with completely broken networking will take 120 * (15 + 1) seconds (32 minutes) to error out. This has started to become an issue for us as we make more use of more dynamic environments.

We could force the behaviour the code expects by adding -retry=1 -timeout=1 to nslookup, although the sleep would still make the loop take longer than two minutes.

Or we could remove the loop completely and just use something like nslookup -retry=12 -timeout=10

Current code:

# Wait for functional network up by testing DNS lookup via nslookup.
wait_for_network () {
    # Wait up to 2 minutes until the network comes up
    i=0
    while ! nslookup \$1 > /dev/null
    do
        sleep 1
        let i=\$i+1
        if [ \$i -gt 120 ]
        then
            fail "Network does not come up (nslookup \$1)"
        fi
    done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant