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

Integers not being displayed properly for 'sender_has_retransmits' and possibly other items. #1435

Closed
WatcherOfTheSkies opened this issue Dec 9, 2022 · 4 comments

Comments

@WatcherOfTheSkies
Copy link
Contributor

WatcherOfTheSkies commented Dec 9, 2022

NOTE: The iperf3 issue tracker is for registering bugs, enhancement
requests, or submissions of code. It is not a means for asking
questions about building or using iperf3. Those are best directed
towards the Discussions section for this project at
https://github.com/esnet/iperf/discussions
or to the iperf3 mailing list at iperf-dev@googlegroups.com.
A list of frequently-asked questions
regarding iperf3 can be found at http://software.es.net/iperf/faq.html.

Context

Testing with debug enabled.

  • Version of iperf3:
    V3.12

  • Hardware:
    Custom ARM based RF board as the server and a Raspberry Pi as the client

  • Operating system (and distribution, if any):
    Linux

Please note: iperf3 is supported on Linux, FreeBSD, and macOS.
Support may be provided on a best-effort basis to other UNIX-like
platforms. We cannot provide support for building and/or running
iperf3 on Windows, iOS, or Android.

  • Other relevant information (for example, non-default compilers,
    libraries, cross-compiling, etc.):

Please fill out one of the "Bug Report" or "Enhancement Request"
sections, as appropriate. Note that submissions of bug fixes, new
features, etc. should be done as a pull request at
https://github.com/esnet/iperf/pulls

Bug Report

The code snippet is from iperf_api.c

if ( test->mode == RECEIVER )
  sender_has_retransmits = -1;
else
  sender_has_retransmits = test->sender_has_retransmits;

cJSON_AddNumberToObject(j, "sender_has_retransmits", sender_has_retransmits);

The item sender_has_retransmits is an int, However, it's reported in Json via cJSON_AddNumberToObject. This function takes a double as the value. Consequently, -1 gets displayed as 18446744073709551615

  • Expected Behavior

"retransmits": -1,
or
"retransmits": <ANY_INT_VALUE>,

  • Actual Behavior
    send_results
    {
    "cpu_util_total": 0.21799147343840383,
    "cpu_util_user": 0,
    "cpu_util_system": 0.21797719109067146,
    "sender_has_retransmits": 18446744073709551615,
    "congestion_used": "cubic",
    "streams": [{
    "id": 1,
    "bytes": 0,
    "retransmits": 18446744073709551615,
    "jitter": 0,
    "errors": 0,
    "packets": 0,
    "start_time": 0,
    "end_time": 5.000827
    }]
    }

  • Steps to Reproduce
    Server: iperf3 --server -1 -p 5201 --verbose
    Client: iperf3 --client 192.168.200.242 --port 5201 --bind 10.0.0.2%wwan0 --time 5 --verbose --reverse -d

This was spotted when the -d option was used.

  • Possible Solution

Perhaps a function with...
cJSON_AddDoubleToObject
cJSON_AddIntToObject

Enhancement Request

  • Current behavior

  • Desired behavior

  • Implementation notes

@WatcherOfTheSkies
Copy link
Contributor Author

The use case is very specific but the reporting will be generic. I'm surprised this hasn't been seen more often.

@WatcherOfTheSkies
Copy link
Contributor Author

Would it be better if variables like sender_has_retransmits were initialised to 0 instead? Then if there were no retransmits, at least it would display 0. I'm not sure at this time if there are any further side effects by doing this.

davidBar-On added a commit to davidBar-On/iperf that referenced this issue Jul 4, 2023
@davidBar-On
Copy link
Contributor

The "sender_has_retransmits" and "retransmits" related variables values are -1 as required. The problem is only in the printing of these values, as numbers from struct cJSON are printed as unsigned numbers. Probably this was not detected before since this is a debug message and there are no other cases of printing negative values from the JSON structure.

Submitted a PR #1539 with a fix.

@WatcherOfTheSkies
Copy link
Contributor Author

Excellent! I'm glad that there is a better solution.
Thank You.

coolshou pushed a commit to coolshou/iperf that referenced this issue Jul 13, 2023
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

No branches or pull requests

2 participants