Repository navigation
fix(containerlab): Stop lab checks leaking port-forwards that hold the lab - #1450
Merged
Merged
Conversation
verify-fabric-api.sh started its gateway port-forward by backgrounding the k shell function. Bash runs a backgrounded function in a subshell, so $! named the subshell and both cleanup paths killed only it, leaving kubectl port-forward running after the script exited. Under the lab manager those orphans inherited the reservation lock and held it until someone killed them. Start kubectl directly so PF_PID is its own PID, stop it through a stop_pf helper that kills and waits, and turn INT and TERM into an exit so an interrupt still runs the EXIT cleanup. verify-nat-active-active.sh had the same pattern: soak_start backgrounded the pod_exec function, and cleanup never stopped the download. Run its docker exec directly, kill and wait for it in cleanup, and clear SOAK_PID once soak_check has waited for it. Fixes #1449
Collaborator
Author
|
Commands and raw output behind the results table. Evidence wrapper: one
Handoff:
Static checks:
|
privateip
marked this pull request as ready for review
November 19, 2026 03:41
privateip
merged commit Nov 19, 2026
aac8a32
into
integration/galactic-worker
35 of 36 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The fabric API lab check left one kubectl port-forward running per site after it finished. Under the lab manager those processes inherited the reservation lock, so the shared lab stayed locked until someone killed them by hand. This PR makes the check stop its port-forward whether it passes, fails or is interrupted. It also fixes the NAT active/active lab check, which leaked its background download in the same way.
The cause was the same in both scripts. Each started its background job through a shell function. Bash runs a backgrounded function in a subshell, so the script recorded the subshell's process ID, and cleanup killed only the subshell. Both scripts now start the command directly, kill it and wait for it in cleanup, and the fabric API check turns Ctrl-C and SIGTERM into a normal exit so that cleanup always runs. No other lab script backgrounds a function.
Results on the shared three-site lab, all under one reservation:
The exit codes are the check script's own; the task runner wrapped both failures as 201. The first comment has the commands and raw output.
After the run released the lab, no port-forward remained and the lab matched its starting snapshot. The manager showed the lab busy, not available, because a queued run from another issue took the lock the same second. None of the processes holding the lock came from this run.
Not covered:
Lint passed locally with 0 issues. The same bug is on main and reaches it when the integration branch merges.
Fixes #1449