JSON group_reporting mixes first job name with last job's job options
Please acknowledge the following before creating a ticket
- [ X] I have read the GitHub issues section of REPORTING-BUGS.
Description of the bug:
When group_reporting=1 is used with JSON output and multiple jobs belong
to the same reporting group, the resulting JSON object appears to mix
metadata from different jobs.
The reported jobname comes from the first job in the group, while the
contents of "job options" appear to come from the last job in the group.
For example, with two jobs in the same reporting group:
[write-bank-A]
filename_format=bank-A.$filenum
rw=write
...
[write-bank-B]
filename_format=bank-B.$filenum
rw=write
...the resulting JSON contains:
"jobname": "write-bank-A",
...
"job options": {
...
"filename_format": "bank-B.$filenum"
}So the resulting group object effectively contains:
jobname -> first job in the reporting group
job options -> last job in the reporting group
statistics -> aggregated group statisticsThe aggregate statistics indicate that both jobs actually ran, so this appears to be a reporting issue rather than an execution issue.
This is potentially misleading for programs consuming fio JSON output, because the JSON object identifies one job by name while its job-specific options can belong to another job.
I would expect one of the following behaviours:
- Use the first job's options consistently with the reported
jobname. - Omit job-specific options that are ambiguous at group level.
- Represent the individual jobs/options separately from the aggregated group statistics.
The first option would appear particularly consistent with other
group-level fields such as job_start, which are taken from the first
job in the reporting group.
A possible cause appears to be the handling of opt_lists in stat.c.
While processing multiple jobs belonging to the same reporting group, the reporting-group index does not advance, but the option-list pointer is assigned for each job:
opt_lists[j] = &td->opt_list;This means later jobs in the group can overwrite the option-list pointer for the same group.
In contrast, fields such as the group name and job_start are initialized
from the first job in the group.
As a result, JSON generation can combine the first job's name with the last job's option list.
Environment:
Linux, using fio with libaio.
The issue was observed with a workload using:
group_reporting=1
ioengine=libaio
direct=1The jobs in question were two concurrent write jobs in the same reporting
group with different filename_format values.
fio version:
fio-3.36-117-gb2403Reproduction steps
Create test.fio:
[global]
ioengine=sync
rw=write
size=1M
group_reporting=1
directory=/tmp
[first]
filename_format=fio-first.$filenum
[second]
filename_format=fio-second.$filenumRun:
fio --output-format=json test.fioInspect the first object in the jobs array.
Expected:
The jobname and "job options" should refer consistently to the same
job, or job-specific options should not be attributed to a single job
when reporting aggregated group statistics.
Actual:
The JSON can contain a result equivalent to:
{
"jobname": "first",
"groupid": 0,
...
"job options": {
...
"filename_format": "fio-second.$filenum"
}
}Thus the group is named after the first job while its "job options"
come from the second/last job in the reporting group.
Source: axboe/fio