Free rendered JSON output when resetting server tests - #2067
Open
MikeeI wants to merge 1 commit into
Open
Conversation
Persistent servers reuse one iperf_test across runs. Free the test-owned rendered JSON string during reset so the next full JSON result cannot orphan the previous allocation.
MikeeI
added a commit
to MikeeI/iperf
that referenced
this pull request
Aug 14, 2026
Record upstream PR esnet#2067 and advance the verified JSON reset fix to Published.
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.
PLEASE NOTE the following text from the iperf3 license. Submitting a
pull request to the iperf3 repository constitutes "[making]
Enhancements available...publicly":
The complete iperf3 license is available in the
LICENSEfile in thetop directory of the iperf3 source tree.
Version of iperf3 (or development branch, such as
masteror3.1-STABLE) to which this pull request applies:masteratc9b74229d0d9bfec6d2307b66b43c29a7665ad0bIssues fixed (if any): None.
Brief description of code changes (suitable for use as a commit message):
Release the test-owned rendered JSON string when resetting a server test.
Summary
A persistent server reuses one
iperf_testacross runs. Full JSON rendering stores a heap copy intest->json_output_string, but reset did not release it before the next result replaced the pointer. This change frees and clears that test-owned string iniperf_reset_test.Evidence
iperf_json_finishduplicates the rendered document intojson_output_string.iperf_reset_testdid not release that string before persistent-server reuse.-Jserver receiving sequential one-second, 32-stream localhost tests retained 628 KiB over warm runs 20–40, or 31.4 KiB/run. A representative rendered document was 32,134 bytes.Changes
json_output_stringat the reset lifecycle boundary.Risks and boundaries
iperf_reset_testalready invalidates test-owned result state for the next run; this applies the same lifetime to the rendered string.free-and-NULL pattern and adds no new abstraction or platform-specific behavior.Verification
--json-stream --json-stream-full-outputruns emitted JSON accepted byjq empty.make -s check— 5/5 tests passed.test_commands.sh 127.0.0.1— completed with status 0 in an isolated network namespace; IPv6 was unavailable for the IPv4-only target.I checked the relevant issues, comments, pull requests, discussions, and
iperf-devsearch results; this pull request is not a duplicate.Disclosure
Investigated thoroughly with GPT-5.6 (extra high reasoning effort), using Oh My Pi as the agent framework.
This report is not generic or unreviewed AI-generated output. Its claims were checked against the cited evidence, and it includes the relevant detail intended to help maintainers resolve the issue.
If reports like this are not useful to the project, please let me know and I will refrain from submitting similar ones. My intent is to help without wasting maintainer time or energy or discouraging their work.
Thank you for your work.