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

Invalid JSON output containing "Input/output error" #1685

Open
1 task done
sbraz opened this issue Dec 13, 2023 · 2 comments
Open
1 task done

Invalid JSON output containing "Input/output error" #1685

sbraz opened this issue Dec 13, 2023 · 2 comments

Comments

@sbraz
Copy link

sbraz commented Dec 13, 2023

Please acknowledge the following before creating a ticket

Description of the bug:
Hi,
I noticed that when certain errors occur, the output file contains invalid JSON.

Environment: Debian 10, kernel 6.1.51

fio version: master branch at f53eaac

Reproduction steps

root@localhost ~/fio-master # ./fio --norandommap --time_based --runtime="30s" --readwrite=randrw --numjobs=1 --thread --name=test --group_reporting --output-format=json --output="sdb.log" --filename="/dev/sdb"                                     
fio: io_u error on file /dev/sdb: Input/output error: read offset=184912257024, buflen=4096
root@localhost ~/fio-master # head sdb.log
fio: io_u error on file /dev/sdb: Input/output error: read offset=184912257024, buflen=4096
fio: pid=5509, err=5/file:io_u.c:1896, func=io_u error, error=Input/output error
{
  "fio version" : "fio-3.36",
  "timestamp" : 1702479026,
  "timestamp_ms" : 1702479026165,
  "time" : "Wed Dec 13 14:50:26 2023",
  "global options" : {
    "runtime" : "30s",
    "rw" : "randrw",

Complete log file:
sdb.log

@vincentkfu
Copy link
Collaborator

The problem is that JSON output and other output can be sent to the same destination. We should probably collect all info and error messages and create a new key to store these contents. To work around this problem, just do something like this:

earlephilhower/ezfio@f5e2ef1

@sbraz
Copy link
Author

sbraz commented Jan 19, 2024

Thanks for the reply. Putting error messages in a separate key would be a good idea indeed. I believe that's what smartctl does for instance.
I applied a similar workaround with sed -n '/^{/,$p' although I wasn't 100% comfortable with it as I wasn't sure that errors would always appear before the JSON.

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