Bug 254635 - vmstat libxo output malformed
Summary: vmstat libxo output malformed
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.2-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-29 01:17 UTC by Nick Venenga
Modified: 2021-03-29 01:17 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Venenga 2021-03-29 01:17:37 UTC
JSON when used with `-w` flag

```
# vmstat --libxo json -w 5
{"__version": "1", "processes": {"runnable":63,"waiting":9,"swapped-out":2}
, "memory": {"available-memory":"  36G","free-memory":" 1.2G","total-page-faults":4593}
, "paging-rates": {"page-reactivated":5,"paged-in":0,"paged-out":22,"freed":6717,"scanned":722}
, "device": [{"name":"da0","transfers":"0"}, {"name":"da1","transfers":"0"}], "fault-rates": {"interrupts":1169,"system-calls":68996,"context-switches":39163}
, "cpu-statistics": {"user":" 8","system":"21","idle":"71"}

, "processes": {"runnable":51,"waiting":9,"swapped-out":2}
, "memory": {"available-memory":"  37G","free-memory":" 1.2G","total-page-faults":4576}
, "paging-rates": {"page-reactivated":0,"paged-in":0,"paged-out":47,"freed":3771,"scanned":3834}
, "device": [{"name":"da0","transfers":"0"}, {"name":"da1","transfers":"17"}], "fault-rates": {"interrupts":421,"system-calls":106121,"context-switches":19317}
, "cpu-statistics": {"user":"87","system":"13","idle":" 0"}
```
(space added between successive outputs). I'd expect either json lines or back-to-back complete json objects but the second iteration returns a partial blob


```
# vmstat --libxo xml
<processes version="1"><runnable>30</runnable><waiting>9</waiting><swapped-out>2</swapped-out></processes><memory><available-memory value="39004778496">  36G</available-memory><free-memory value="1409699840"> 1.3G</free-memory><total-page-faults>4592</total-page-faults></memory><paging-rates><page-reactivated>5</page-reactivated><paged-in>0</paged-in><paged-out>22</paged-out><freed>6713</freed><scanned>728</scanned></paging-rates><device><name>da0</name><transfers>0</transfers></device><device><name>da1</name><transfers>0</transfers></device><fault-rates><interrupts>1168</interrupts><system-calls>69080</system-calls><context-switches>39135</context-switches></fault-rates><cpu-statistics><user> 8</user><system>21</system><idle>71</idle></cpu-statistics>
```
XML is missing root element. Using `-w` prints successive like the above example

Not sure if these issues are related but in both cases there are issues with the libxo output