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

Add retries to SSH iperf on server #342

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Conversation

pau-hedgehog
Copy link
Contributor

Extend show tech logs gathered on server VMs

Fixes #310

@pau-hedgehog pau-hedgehog self-assigned this Jan 24, 2025
out, err := toSSH.RunContext(ctx, fmt.Sprintf("toolbox -q timeout -v %d iperf3 -s -1", opts.IPerfsSeconds+25))
if err != nil {
return fmt.Errorf("running iperf server: %w: %s", err, string(out))
maxRetries := 3
Copy link
Member

Choose a reason for hiding this comment

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

the context.WithTimeout is built around iperfsseconds so there is no "time" to retry and if we're restarting the server we most probably need to restart the client as well. It maybe makes sense to retry the whole checkIPerf function

@pau-hedgehog pau-hedgehog force-pushed the iperf_ssh_retries branch 2 times, most recently from 70278c4 to 7877d91 Compare January 27, 2025 19:14
if err := iperfs.Acquire(ctx, 1); err != nil {
return fmt.Errorf("acquiring iperf semaphore: %w", err)
}
defer iperfs.Release(1)
Copy link
Member

Choose a reason for hiding this comment

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

Defer in the loop will be called when the parent function containing the loop finished, not when one iteration of the loop is finished so it'll stuck forever after a first attempt

Copy link
Member

@Frostman Frostman left a comment

Choose a reason for hiding this comment

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

Please fix defer in the loop usage, one option is to wrap the loop body into the inline func and call it immediately:

for {
  func() { ... }()
}

Extend show tech logs gathered on server VMs

Fixes #310

Signed-off-by: Pau Capdevila <[email protected]>
Add iperf server readiness check

Signed-off-by: Pau Capdevila <[email protected]>

slog.Debug("Running iperf", "from", from, "to", to)
g.Go(func() error {
Copy link
Contributor

Choose a reason for hiding this comment

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

There is something I don't understand... If I read the docs on golang's errgroup correctly, each of these functions will be started immediately in a separate goroutine (as we are not setting any limit on the errgroup), but the operations should actually be sequential, or at least partly so - i.e. starting the server and checking for it in the client could be done in parallel, although I'm not quite sure what the benefits are, but you definitely do not want to start the actual client until the server is ready, especially since that operation does not have a retry. Did I misinterpret something here?

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.

VLAB fails to run iperf server or client
3 participants