Incorrect values on iostat command when using JSON output

Bug #1888345 reported by Fran Freire
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
sysstat (Ubuntu)
Fix Released
Low
Unassigned
Bionic
Invalid
Undecided
Miriam España Acebal
Focal
Fix Released
Low
Miriam España Acebal

Bug Description

[SRU]

[Impact]
In iostat (Focal), when using output option JSON, the values for the number of megabytes written to the device per second (wMB/s) are wrong (they are expressed in blocks/s instead).

[Test Case]
Using the command "iostat <device> -dmx 1 -o JSON" in one terminal and the same command whithout "-o JSON" in another one, and you'll see that all the values match except wMB/s (<device> can be from lsblk output in case of doubt).

Results for Focal (VM):
Before (spoiler: 0.23 vs 483.45 wMB/s):
- Non JSON output: https://pastebin.canonical.com/p/vXJ2xQPXW3/
- JSON output: https://pastebin.canonical.com/p/ncGvCzgHCg/

After (spoiler: 0.03 vs 0.03 wMB/s):
- Non JSON output: https://pastebin.canonical.com/p/QhmWBHXCcG/
- JSON output: https://pastebin.canonical.com/p/XWQtNGHNkP/

PPA with built package with fix for testing: https://launchpad.net/~mirespace/+archive/ubuntu/srus/+packages ( ppa:mirespace/srus )

[Where Problems Could Occur]
 This patch is cherry picked from upstream, so the bug is corrected in following sysstat package versions, only affects iostat commad.

 If the problem was not noticed by a Focal user could be led to strangeness if this output is used in custom scripts.

[Other Info]
Fixed upstream in version 12.3.1, commit id:404eee1417dad8abe6ef49ea6e1469fe6cfdddbe
Commit description: iostat: Fix wrong unit used in JSON output

The values for the amount of data read/written or discarded were always
expressed in blocks/s in the JSON output generated by iostat. It should
take into account the unit (blocks, kB, MB) selected by the user.

Bug on upstream: https://github.com/sysstat/sysstat/issues/264

[Original Report]
---

We are migrating our servers to Ubuntu Focal and we have noticed that our custom charts show unreal values for disk usage.

The issue only happens when you choose the JSON output flag. We have already open an issue on github and the maintainer confirmed the bug. https://github.com/sysstat/sysstat/issues/264

I have checked that on version 12.3.4 it's solved, but Ubuntu Focal uses 12.2.0 and this version is affected by the issue.

This is the commit with the fix: https://github.com/sysstat/sysstat/commit/404eee1417dad8abe6ef49ea6e1469fe6cfdddbe

These are the steps to reproduce the issue. We use the command "iostat /dev/sdb -dmx 1 -o JSON" in one terminal and the same command whithout "-o JSON" in another one, and you'll see that all the values match except wMB/s, I attach three examples below:

"disk": [
 {"disk_device": "nvme0n1", "r/s": 0.00, "w/s": 31.00, "d/s": 0.00, "rMB/s": 0.00, "wMB/s": 248.00, "dMB/s": 0.00, "rrqm/s": 0.00, "wrqm/s": 0.00, "drqm/s": 0.00, "rrqm": 0.00, "wrqm": 0.00, "drqm": 0.00, "r_await": 0.00, "w_await": 1.87, "d_await": 0.00, "rareq-sz": 0.00, "wareq-sz": 4.00, "dareq-sz": 0.00, "aqu-sz": 0.00, "util": 0.80}
 ]

Device r/s rMB/s rrqm/s %rrqm r_await rareq-sz w/s wMB/s wrqm/s %wrqm w_await wareq-sz d/s dMB/s drqm/s %drqm d_await dareq-sz aqu-sz %util
nvme0n1 0,00 0,00 0,00 0,00 0,00 0,00 31,00 0,12 0,00 0,00 1,87 4,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,80
-----------------------------------------------------------------------
"disk": [
 {"disk_device": "sdc", "r/s": 0.00, "w/s": 2.00, "d/s": 0.00, "rMB/s": 0.00, "wMB/s": 24.00, "dMB/s": 0.00, "rrqm/s": 0.00, "wrqm/s": 1.00, "drqm/s": 0.00, "rrqm": 0.00, "wrqm": 33.33, "drqm": 0.00, "r_await": 0.00, "w_await": 2.00, "d_await": 0.00, "rareq-sz": 0.00, "wareq-sz": 6.00, "dareq-sz": 0.00, "aqu-sz": 0.00, "util": 0.40}
 ]

Device r/s rMB/s rrqm/s %rrqm r_await rareq-sz w/s wMB/s wrqm/s %wrqm w_await wareq-sz d/s dMB/s drqm/s %drqm d_await dareq-sz aqu-sz %util
sdc 0.00 0.00 0.00 0.00 0.00 0.00 2.00 0.01 1.00 33.33 2.00 6.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.40
-----------------------------------------------------------------------
"disk": [
 {"disk_device": "sdb", "r/s": 0.00, "w/s": 35.00, "d/s": 0.00, "rMB/s": 0.00, "wMB/s": 280.00, "dMB/s": 0.00, "rrqm/s": 0.00, "wrqm/s": 0.00, "drqm/s": 0.00, "rrqm": 0.00, "wrqm": 0.00, "drqm": 0.00, "r_await": 0.00, "w_await": 0.11, "d_await": 0.00, "rareq-sz": 0.00, "wareq-sz": 4.00, "dareq-sz": 0.00, "aqu-sz": 0.00, "util": 0.40}
 ]

Device r/s rMB/s rrqm/s %rrqm r_await rareq-sz w/s wMB/s wrqm/s %wrqm w_await wareq-sz d/s dMB/s drqm/s %drqm d_await dareq-sz aqu-sz %util
sdb 0.00 0.00 0.00 0.00 0.00 0.00 35.00 0.14 0.00 0.00 0.11 4.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.40

Related branches

description: updated
no longer affects: sysstat (Ubuntu Groovy)
Changed in sysstat (Ubuntu):
importance: Undecided → Low
Changed in sysstat (Ubuntu Focal):
importance: Undecided → Low
Changed in sysstat (Ubuntu):
status: New → Triaged
Changed in sysstat (Ubuntu Focal):
status: New → Triaged
tags: added: bitesize
Revision history for this message
Paride Legovini (paride) wrote :

I'm changing the main bug task to Fix Released as IIUC this is fixed in >= Groovy.

Still valid and in our queue for Focal, needs a SRU.

Changed in sysstat (Ubuntu):
status: Triaged → Fix Released
Changed in sysstat (Ubuntu Focal):
assignee: nobody → Miriam España Acebal (mirespace)
Changed in sysstat (Ubuntu Focal):
status: Triaged → In Progress
Revision history for this message
Miriam España Acebal (mirespace) wrote :

On Bionic, we cannot reproduce the bug:

 - Non JSON output: https://pastebin.canonical.com/p/9w23JxPt2d/
 - JSON output: https://pastebin.canonical.com/p/NHJ9x7s8nz/

Changed in sysstat (Ubuntu Bionic):
status: New → Invalid
description: updated
description: updated
Revision history for this message
Robie Basak (racb) wrote : Please test proposed package

Hello Fran, or anyone else affected,

Accepted sysstat into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/sysstat/12.2.0-2ubuntu0.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in sysstat (Ubuntu Focal):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-focal
Revision history for this message
Miriam España Acebal (mirespace) wrote :

Hi all,

Doing the verification on Focal:

- Installing from proposed pocket:

root@focal:~# apt-get install sysstat/focal-proposed
Reading package lists... Done
Building dependency tree
Reading state information... Done
[. . . ]
Setting up sysstat (12.2.0-2ubuntu0.1) ...

[. . .]

- Executing in two terminals:

iostat nvme0n1 -dmx 1 -o JSON > json : https://pastebin.canonical.com/p/ZGGBrSyyWv/

iostat nvme0n1 -dmx 1 > no-json : https://pastebin.canonical.com/p/g8WCsmgswb/

Except for the 2nd line, with a very slight difference (looks like a spurious I/O spike) all wMB/s values match.

tags: added: verification-done verification-done-focal
removed: verification-needed verification-needed-focal
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package sysstat - 12.2.0-2ubuntu0.1

---------------
sysstat (12.2.0-2ubuntu0.1) focal; urgency=medium

  * d/p/12-fix-wMB-json-output.patch: Correct values for the number of
    megabytes written to the device per second when using JSON output.
    Thanks to Sebastien GODARD <email address hidden> #264
    on upstream (LP: #1888345).

 -- Miriam España Acebal <email address hidden> Mon, 09 Aug 2021 16:08:06 +0200

Changed in sysstat (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for sysstat has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Changed in sysstat (Ubuntu Bionic):
assignee: nobody → Miriam España Acebal (mirespace)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers