[AI Generated] BugFix: iperf3 force source build for versions >= 3.14 to avoid UDP segfault#4445
[AI Generated] BugFix: iperf3 force source build for versions >= 3.14 to avoid UDP segfault#4445Gnandeep99 wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Updates LISA’s iperf3 tool installation logic to avoid a known UDP segfault in newer distro-packaged iperf3 versions, and adjusts nested VM connection setup to respect the effective host connection address (honoring use_public_address).
Changes:
- Detect installed iperf3 version and force a source build from a known-good ref when the installed version is in the reported UDP-segfault range.
- Pin
git cloneto the intended iperf3 source ref and improve JSON parsing failure handling with aLisaException. - Use
host.connection_info["address"](effective address) instead ofhost.public_addresswhen connecting to nested VMs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| lisa/tools/iperf3.py | Adds iperf3 version detection and conditional source rebuild; pins clone ref; improves JSON parse failure error handling. |
| lisa/microsoft/testsuites/nested/common.py | Uses the host’s effective connection address for nested VM connectivity to respect use_public_address. |
| # iperf3 versions 3.14+ have a known segfault in UDP mode with high | ||
| # parallelism (-P 64+). Force a source build from _branch when the | ||
| # distro-installed version falls in this buggy range. |
There was a problem hiding this comment.
The PR template description is empty. Please add a description explaining what this PR does and why, and (if applicable) link the related issue for traceability.
| # iperf3 versions 3.14+ have a known segfault in UDP mode with high | ||
| # parallelism (-P 64+). Force a source build from _branch when the | ||
| # distro-installed version falls in this buggy range. |
There was a problem hiding this comment.
The comment about the "known UDP segfault" would be more actionable if it referenced an upstream issue/commit (or internal tracking link) and, if known, the version where it is fixed. This helps future maintainers validate whether the forced downgrade is still necessary.
| # iperf3 versions 3.14+ have a known segfault in UDP mode with high | |
| # parallelism (-P 64+). Force a source build from _branch when the | |
| # distro-installed version falls in this buggy range. | |
| # iperf3 versions >= 3.14.0 have been observed to segfault in UDP mode | |
| # with high parallelism (-P 64+), so versions in that range are replaced | |
| # with a source build from _branch. When the upstream issue/commit and the | |
| # first fixed release are confirmed, record them here and remove or narrow | |
| # this workaround only after validating that fixed version in LISA. |
| f"Failed to parse iperf3 JSON output. " | ||
| f"Raw output (first 500 chars): {result[:500]}" |
There was a problem hiding this comment.
This exception message explains what happened, but it doesn’t give a next step to investigate/resolve. Consider mentioning common causes (e.g., iperf3 crash/segfault or non-JSON output because -J wasn’t used) and what to check (exit code, iperf3 version, full stdout/stderr/logfile).
| f"Failed to parse iperf3 JSON output. " | |
| f"Raw output (first 500 chars): {result[:500]}" | |
| "Failed to parse iperf3 JSON output. " | |
| "This usually means iperf3 produced non-JSON output, such as " | |
| "running without JSON mode enabled, a crash/segfault, or truncated " | |
| f"output. Verify the iperf3 command used JSON output and inspect the " | |
| f"full stdout/stderr or logfile for errors. Raw output (first 500 " | |
| f"chars): {result[:500]}" |
| # Use the host's connection address which respects use_public_address setting. | ||
| host_address = host.connection_info["address"] | ||
| connection_info = schema.ConnectionInfo( | ||
| address=host.public_address, | ||
| address=host_address, | ||
| port=guest_port, |
There was a problem hiding this comment.
To match the established pattern elsewhere in the repo, consider indexing connection_info with constants.ENVIRONMENTS_NODES_REMOTE_ADDRESS instead of the string literal "address". This avoids typos and keeps key usage consistent.
| # setup connection to nested vm | ||
| host_address = host.connection_info["address"] | ||
| connection_info = schema.ConnectionInfo( | ||
| address=host.public_address, | ||
| address=host_address, | ||
| port=port, |
There was a problem hiding this comment.
To match the established pattern elsewhere in the repo, consider indexing connection_info with constants.ENVIRONMENTS_NODES_REMOTE_ADDRESS instead of the string literal "address". This avoids typos and keeps key usage consistent.
✅ AI Test Selection — PASSED1 test case(s) selected (view run) Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest
Test case details
|
f690e60 to
319a91f
Compare
319a91f to
33c3437
Compare
✅ AI Test Selection — PASSED4 test case(s) selected (view run) Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest
Test case details
|
33c3437 to
edabc9c
Compare
✅ AI Test Selection — PASSED4 test case(s) selected (view run) Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest
Test case details
|
|
@Gnandeep99 please double check the logic, I ran case perf_tcp_iperf_sriov + canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest, I saw the iperf version is 3.9 and the iperf was not upgraded. |
| # iperf3 >= 3.14 segfaults in UDP mode with high parallelism. | ||
| # Force a source build from a known-good version. | ||
| version = self.get_version() | ||
| if version and version >= self._buggy_version_min: | ||
| self._log.info( | ||
| f"iperf3 {version} has known UDP segfault, " | ||
| f"rebuilding from source ({self._branch})" | ||
| ) | ||
| install_from_src = True |
… to avoid UDP segfault
edabc9c to
aa5f4e7
Compare
|
Hi @LiliDeng, thanks for testing this! The behavior you saw is actually expected, iperf3 3.9 is below the 3.14 threshold, so the fix intentionally leaves it as-is. Could you give it another run when you get a chance? The logs should now make it clear the check is working. |
✅ AI Test Selection — PASSED4 test case(s) selected (view run) Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest
Test case details
|
…around - Treat unparseable iperf3 -v output as rebuild trigger so the segfault mitigation cannot be silently bypassed by an unexpected version output format - Expand _buggy_version_min comment with upstream tracking placeholder and first-fixed-release guidance - Enrich _pre_handle LisaException with actionable diagnostic hints (missing -J, crash/segfault, truncated output)
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
lisa/tools/iperf3.py:167
- The workaround is implemented inside Iperf3.install(), but Tools.get() only calls tool.install() when tool.exists is False (see lisa/executable.py:660-666). If iperf3 is already present on the image, this new version gate won’t run and a buggy distro iperf3 (>= 3.14) will still be used, defeating the purpose of the change.
Consider moving the version/feature checks into an override of _check_exists() (or exists) so it returns False when the installed iperf3 is >= _buggy_version_min (or lacks --logfile), which will cause Tools.get() to invoke install() and rebuild from source as intended.
def install(self) -> bool:
posix_os: Posix = cast(Posix, self.node.os)
try:
posix_os.install_packages("iperf3")
except Exception as e:
self._log.debug(f"Failed to install iperf3 from package manager: {e}")
install_from_src = False
if self._check_exists():
if "--logfile" not in self.help().stdout:
install_from_src = True
else:
# iperf3 >= 3.14 segfaults in UDP mode with high parallelism.
# Force a source build from a known-good version. If the
# version cannot be parsed, fail safe and rebuild so the
# mitigation cannot be silently bypassed by an unexpected
# `iperf3 -v` output format.
version = self.get_version()
if version is None:
self._log.warning(
"could not parse iperf3 version output; "
f"rebuilding from source ({self._branch}) as a "
"precaution against the known UDP segfault"
)
install_from_src = True
elif version >= self._buggy_version_min:
self._log.info(
f"iperf3 {version} has known UDP segfault, "
f"rebuilding from source ({self._branch})"
)
install_from_src = True
else:
self._log.debug(
f"iperf3 {version} is below buggy threshold "
f"{self._buggy_version_min}, keeping distro version"
)
else:
install_from_src = True
if install_from_src:
self._install_from_src()
return self._check_exists()
| # iperf3 versions >= 3.14.0 have been observed to segfault in UDP mode | ||
| # with high parallelism (-P 64+), so versions in that range are replaced | ||
| # with a source build from _branch (the last known-good release for the | ||
| # workloads exercised by LISA). | ||
| # | ||
| # Upstream tracking: https://github.com/esnet/iperf/issues (link the | ||
| # specific issue/commit here once filed). | ||
| # First fixed release: TBD - bump _buggy_version_min to that version, or | ||
| # remove this workaround entirely, once the upstream fix is confirmed. |
✅ AI Test Selection — PASSED4 test case(s) selected (view run) Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest
Test case details
|
…review - Replace generic 'Upstream tracking' URL and 'TBD' placeholder with an explicit TODO that calls out the missing upstream issue link and first-fixed release, so the action item is harder to forget
✅ AI Test Selection — PASSED4 test case(s) selected (view run) Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest
Test case details
|
Summary
Force source build of iperf3 from tag 3.10.1 when the distro-installed version is >= 3.14, which has a known segfault in UDP mode with high parallelism (-P 64+). Also passes ref to git.clone() and replaces bare assert with LisaException for better diagnostics.
Validation Results