action #121444
logreport o3: Can't open file ".../details-gd.json": No such file or directory at OpenQA/Schema/Result/JobModules.pm line 95 size:M
Start date:
2022-12-05
Due date:
2022-12-20
% Done:
0%
Estimated time:
Difficulty:
Description
Observation¶
We saw the following error on o3 today:
[2022-12-05T10:45:55.571462Z] [error] [JBm0Hyi1i4oq] Can't open file "/var/lib/openqa/testresults/01371/01371619-opensuse-Jump:15.2-DVD-ppc64le-Build39.13-extra_tests_in_textmode@ppc64le/ details-gd.json": No such file or directory at /usr/share/openqa/script/../lib/OpenQA/Schema/Result/JobModules.pm line 95.
It seems like the test got deleted because we have this in the access log:
[05/Dec/2022:10:45:50 +0000] "GET /tests/1371619 HTTP/1.1" 200
So the test was still there but when loading results it was already deleted, because now it returns a 404.
The according code is
93 return {} unless -r (my $file = path($dir, "details-$name.json")); 94 95 my $json_data = $file->slurp; 96 die qq{Malformed JSON file "$file": $@} unless my $json = eval { decode_json($json_data) };
so not an atomic operation.
Acceptance criteria¶
- AC1: A unit test ensures that a not readable test module result file is handled and gracefully returned to the web UI and no error in log
- AC2: The handling is atomic, not "check if readable and then read"
Suggestions¶
- Instead of trying to read and then fail we should handle the read attempt as we handle the exception in line 96 and return
{}
in case of error
Related issues
History
#2
Updated by dheidler 4 months ago
- Related to action #121441: logreport o3: Can't call method "results" on an undefined value at /.../OpenQA/WebAPI/Controller/Test.pm line 735 added
#3
Updated by mkittler 4 months ago
- Subject changed from logreport o3: Can't open file ".../details-gd.json": No such file or directory at OpenQA/Schema/Result/JobModules.pm line 95 to logreport o3: Can't open file ".../details-gd.json": No such file or directory at OpenQA/Schema/Result/JobModules.pm line 95 size:M
- Description updated (diff)
- Status changed from New to Workable
#6
Updated by okurz 4 months ago
- Due date set to 2022-12-20
https://github.com/os-autoinst/openQA/pull/4948 merged.
We can wait until tomorrow to see if there is any strongly-related problematic outcome. Otherwise I would resolve