UDP link capacity reported as 0 in JSON output
- Dominant language
- C
- Stars
- 8.8k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
# Context
* Version of iperf3:
iperf 3.5 (cJSON 1.5.2)
* Hardware:
VirtualBox VM
* Operating system (and distribution, if any):
Ubuntu 18.04
# Bug Report
The JSON output reports total bytes received to 0 and total bitrate to 0.
The default output reports the total bitrate and bytes received correctly.
* Expected Behavior
The total bytes received should be the sum of the periodic bytes received reports.
The total bitrate should be the total bytes received divided by the duration of the connection.
* Actual Behavior
Client command:
```
iperf3 -c 192.168.0.4 -u
```
Server default output (this is what is expected):
```
iperf3 -s
```
```
> -----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 192.168.2.3, port 53252
[ 6] local 192.168.0.4 port 5201 connected to 192.168.2.3 port 53906
[ ID] Interval Transfer Bitrate Jitter Lost/Total Datagrams
[ 6] 0.00-1.00 sec 55.1 KBytes 452 Kbits/sec 6.478 ms 0/39 (0%)
[ 6] 1.00-2.00 sec 127 KBytes 1.04 Mbits/sec 1.330 ms 0/90 (0%)
[ 6] 2.00-3.00 sec 129 KBytes 1.05 Mbits/sec 2.535 ms 0/91 (0%)
[ 6] 3.00-4.00 sec 127 KBytes 1.04 Mbits/sec 1.406 ms 0/90 (0%)
[ 6] 4.00-5.00 sec 127 KBytes 1.04 Mbits/sec 2.266 ms 0/90 (0%)
[ 6] 5.00-6.00 sec 129 KBytes 1.05 Mbits/sec 1.951 ms 0/91 (0%)
[ 6] 6.00-7.00 sec 129 KBytes 1.05 Mbits/sec 1.593 ms 0/91 (0%)
[ 6] 7.00-8.00 sec 129 KBytes 1.05 Mbits/sec 1.427 ms 0/91 (0%)
[ 6] 8.00-9.00 sec 127 KBytes 1.04 Mbits/sec 1.381 ms 0/90 (0%)
[ 6] 9.00-10.00 sec 127 KBytes 1.04 Mbits/sec 1.212 ms 0/90 (0%)
[ 6] 10.00-10.58 sec 73.5 KBytes 1.03 Mbits/sec 1.859 ms 0/52 (0%)
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Jitter Lost/Total Datagrams
[ 6] 0.00-10.58 sec 1.25 MBytes 991 Kbits/sec 1.859 ms 0/905 (0%) receiver
```
Server JSON output (this is NOT what is expected):
```
iperf3 -s -J
```
```
{
"start": {
"connected": [{
"socket": 6,
"local_host": "192.168.0.4",
"local_port": 5201,
"remote_host": "192.168.2.3",
"remote_port": 50720
}],
"version": "iperf 3.5",
"system_info": "Linux labo-VirtualBox 4.13.0-45-generic #50~16.04.1-Ubuntu SMP Wed May 30 11:18:27 UTC 2018 x86_64",
"timestamp": {
"time": "Fri, 15 Jun 2018 13:49:02 GMT",
"timesecs": 1529070542
},
"accepted_connection": {
"host": "192.168.2.3",
"port": 53250
},
"cookie": "wal54elil5zyamwx2kjwfbiv2ye4inht4aef",
"sock_bufsize": 0,
"sndbuf_actual": 212992,
"rcvbuf_actual": 212992,
"test_start": {
"protocol": "UDP",
"num_streams": 1,
"blksize": 1448,
"omit": 0,
"duration": 10,
"bytes": 0,
"blocks": 0,
"reverse": 0,
"tos": 0
}
},
"intervals": [{
"streams": [{
"socket": 6,
"start": 0,
"end": 1.0005419254302979,
"seconds": 1.0005419254302979,
"bytes": 56472,
"bits_per_second": 451531.30370394728,
"jitter_ms": 5.4631684203400441,
"lost_packets": 0,
"packets": 39,
"lost_percent": 0,
"omitted": false
}],
"sum": {
"start": 0,
"end": 1.0005419254302979,
"seconds": 1.0005419254302979,
"bytes": 56472,
"bits_per_second": 451531.30370394728,
"jitter_ms": 5.4631684203400441,
"lost_packets": 0,
"packets": 39,
"lost_percent": 0,
"omitted": false
}
}, {
"streams": [{
"socket": 6,
"start": 1.0005419254302979,
"end": 2.0001649856567383,
"seconds": 0.99962306022644043,
"bytes": 131768,
"bits_per_second": 1054541.4986337041,
"jitter_ms": 1.6919598513460861,
"lost_packets": 0,
"packets": 91,
"lost_percent": 0,
"omitted": false
}],
"sum": {
"start": 1.0005419254302979,
"end": 2.0001649856567383,
"seconds": 0.99962306022644043,
"bytes": 131768,
"bits_per_second": 1054541.4986337041,
"jitter_ms": 1.6919598513460861,
"lost_packets": 0,
"packets": 91,
"lost_percent": 0,
"omitted": false
}
}, {
"streams": [{
"socket": 6,
"start": 2.0001649856567383,
"end": 3.000032901763916,
"seconds": 0.99986791610717773,
"bytes": 130320,
"bits_per_second": 1042697.7235743667,
"jitter_ms": 1.5736765527118337,
"lost_packets": 0,
"packets": 90,
"lost_percent": 0,
"omitted": false
}],
"sum": {
"start": 2.0001649856567383,
"end": 3.000032901763916,
"seconds": 0.99986791610717773,
"bytes": 130320,
"bits_per_second": 1042697.7235743667,
"jitter_ms": 1.5736765527118337,
"lost_packets": 0,
"packets": 90,
"lost_percent": 0,
"omitted": false
}
}, {
"streams": [{
"socket": 6,
"start": 3.000032901763916,
"end": 4.0004148483276367,
"seconds": 1.0003819465637207,
"bytes": 130320,
"bits_per_second": 1042161.9498244241,
"jitter_ms": 1.5316822491530364,
"lost_packets": 0,
"packets": 90,
"lost_percent": 0,
"omitted": false
}],
"sum": {
"start": 3.000032901763916,
"end": 4.0004148483276367,
"seconds": 1.0003819465637207,
"bytes": 130320,
"bits_per_second": 1042161.9498244241,
"jitter_ms": 1.5316822491530364,
"lost_packets": 0,
"packets": 90,
"lost_percent": 0,
"omitted": false
}
}, {
"streams": [{
"socket": 6,
"start": 4.0004148483276367,
"end": 5.0005488395690918,
"seconds": 1.0001339912414551,
"bytes": 130320,
"bits_per_second": 1042420.3248065611,
"jitter_ms": 1.80109779831896,
"lost_packets": 0,
"packets": 90,
"lost_percent": 0,
"omitted": false
}],
"sum": {
"start": 4.0004148483276367,
"end": 5.0005488395690918,
"seconds": 1.0001339912414551,
"bytes": 130320,
"bits_per_second": 1042420.3248065611,
"jitter_ms": 1.80109779831896,
"lost_packets": 0,
"packets": 90,
"lost_percent": 0,
"omitted": false
}
}, {
"streams": [{
"socket": 6,
"start": 5.0005488395690918,
"end": 6.000154972076416,
"seconds": 0.99960613250732422,
"bytes": 131768,
"bits_per_second": 1054559.3566496815,
"jitter_ms": 1.683127610266788,
"lost_packets": 0,
"packets": 91,
"lost_percent": 0,
"omitted": false
}],
"sum": {
"start": 5.0005488395690918,
"end": 6.000154972076416,
"seconds": 0.99960613250732422,
"bytes": 131768,
"bits_per_second": 1054559.3566496815,
"jitter_ms": 1.683127610266788,
"lost_packets": 0,
"packets": 91,
"lost_percent": 0,
"omitted": false
}
}, {
"streams": [{
"socket": 6,
"start": 6.000154972076416,
"end": 7.0003039836883545,
"seconds": 1.0001490116119385,
"bytes": 131768,
"bits_per_second": 1053986.9437065562,
"jitter_ms": 1.6203054576171958,
"lost_packets": 0,
"packets": 91,
"lost_percent": 0,
"omitted": false
}],
"sum": {
"start": 6.000154972076416,
"end": 7.0003039836883545,
"seconds": 1.0001490116119385,
"bytes": 131768,
"bits_per_second": 1053986.9437065562,
"jitter_ms": 1.6203054576171958,
"lost_packets": 0,
"packets": 91,
"lost_percent": 0,
"omitted": false
}
}, {
"streams": [{
"socket": 6,
"start": 7.0003039836883545,
"end": 8.000424861907959,
"seconds": 1.0001208782196045,
"bytes": 130320,
"bits_per_second": 1042433.9924349393,
"jitter_ms": 1.3385075006647031,
"lost_packets": 0,
"packets": 90,
"lost_percent": 0,
"omitted": false
}],
"sum": {
"start": 7.0003039836883545,
"end": 8.000424861907959,
"seconds": 1.0001208782196045,
"bytes": 130320,
"bits_per_second": 1042433.9924349393,
"jitter_ms": 1.3385075006647031,
"lost_packets": 0,
"packets": 90,
"lost_percent": 0,
"omitted": false
}
}, {
"streams": [{
"socket": 6,
"start": 8.000424861907959,
"end": 9.0005559921264648,
"seconds": 1.0001311302185059,
"bytes": 131768,
"bits_per_second": 1054005.7879907144,
"jitter_ms": 2.6760332096776791,
"lost_packets": 0,
"packets": 91,
"lost_percent": 0,
"omitted": false
}],
"sum": {
"start": 8.000424861907959,
"end": 9.0005559921264648,
"seconds": 1.0001311302185059,
"bytes": 131768,
"bits_per_second": 1054005.7879907144,
"jitter_ms": 2.6760332096776791,
"lost_packets": 0,
"packets": 91,
"lost_percent": 0,
"omitted": false
}
}, {
"streams": [{
"socket": 6,
"start": 9.0005559921264648,
"end": 10.000185012817383,
"seconds": 0.999629020690918,
"bytes": 131768,
"bits_per_second": 1054535.2107438846,
"jitter_ms": 1.4132002938937065,
"lost_packets": 0,
"packets": 91,
"lost_percent": 0,
"omitted": false
}],
"sum": {
"start": 9.0005559921264648,
"end": 10.000185012817383,
"seconds": 0.999629020690918,
"bytes": 131768,
"bits_per_second": 1054535.2107438846,
"jitter_ms": 1.4132002938937065,
"lost_packets": 0,
"packets": 91,
"lost_percent": 0,
"omitted": false
}
}, {
"streams": [{
"socket": 6,
"start": 10.000185012817383,
"end": 10.580043792724609,
"seconds": 0.57985877990722656,
"bytes": 73848,
"bits_per_second": 1018841.1738708542,
"jitter_ms": 1.5506041746410271,
"lost_packets": 0,
"packets": 51,
"lost_percent": 0,
"omitted": false
}],
"sum": {
"start": 10.000185012817383,
"end": 10.580043792724609,
"seconds": 0.57985877990722656,
"bytes": 73848,
"bits_per_second": 1018841.1738708542,
"jitter_ms": 1.5506041746410271,
"lost_packets": 0,
"packets": 51,
"lost_percent": 0,
"omitted": false
}
}],
"end": {
"streams": [{
"udp": {
"socket": 6,
"start": 0,
"end": 10.580043792724609,
"seconds": 10.580043792724609,
"bytes": 0,
"bits_per_second": 0,
"jitter_ms": 1.5506041746410271,
"lost_packets": 0,
"packets": 905,
"lost_percent": 0,
"out_of_order": 0
}
}],
"sum": {
"start": 0,
"end": 10.580043792724609,
"seconds": 10.580043792724609,
"bytes": 0,
"bits_per_second": 0,
"jitter_ms": 1.5506041746410271,
"lost_packets": 0,
"packets": 905,
"lost_percent": 0
},
"cpu_utilization_percent": {
"host_total": 0.043347153484469859,
"host_user": 0.0433497330579931,
"host_system": 0,
"remote_total": 0,
"remote_user": 0,
"remote_system": 0
}
}
}
```
Note that the total bytes received is 0 in the final report whereas it is reported as 130 kB (so around 1 Mb, as expected) in the periodic reports.
* Steps to Reproduce
Send UDP data from the client. Output in JSON with the server.
* Possible Solution
Set the number of bytes received equal to the sum of the number of bytes received in the periodic reports.
Set the bitrate equal to the number of bytes received divided by the connection duration.
Contributor guide
Research direction
Reproduce the issue with the documented `iperf3 -c 192.168.0.4 -u` client and `iperf3 -s -J` server commands, then compare the periodic interval totals with the final JSON report. Done means the final UDP `bytes` and `bits_per_second` fields reflect the received data and connection duration; an open linked pull request already addresses this issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100