parityHistory query fails with NaN when a parity-checks.log record has an empty errors field
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 82/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- graphql, typescript
Rechercherichtung
Beginne in api/src/unraid-api/graph/resolvers/array/parity.service.ts in getParityHistory(), wo jede Zeile von parity-checks.log an '|' aufgeteilt wird und das Feld errors durch Number.parseInt läuft. Das Datum und die Dauer haben bereits Prüfungen, also übernimm dieses Muster für errors. Zum Reproduzieren füge die fehlerhafte Zeile 1969 Dec 31 17:00:00|0|nan B/s|| in ein Test-Log ein und führe die parityHistory-Abfrage aus. Fertig ist es, wenn alle Datensätze zurückgegeben werden und der fehlerhafte Datensatz errors als null hat oder übersprungen wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Environment
Unraid OS Version: 7.3.4 (API 4.37.9+bedd403a, kernel 6.18.58-Unraid)
Are you using a reverse proxy? No. Tested directly against the server's built-in /graphql endpoint over the LAN, authenticated with an x-api-key (ADMIN role).
Hardware / setup that may matter: Supermicro X12STH-F, Xeon E-2356G, USB flash boot device, 1 parity + 11 data disks, 2 pools. This install has been upgraded in place since 2018, so /boot/config/parity-checks.log holds 162 records written by many OS versions: 98 in the old 5-field format and 63 in the current 7-field format, plus the bad record below.
Pre-submission Checklist
- I have verified that my Unraid OS is up to date
- I have tested this issue by accessing my server directly (not through a reverse proxy)
- This is not an Unraid Connect related issue (if it is, please submit via the support form instead)
Issue Description
The parityHistory query fails completely if any record in /boot/config/parity-checks.log has an empty errors field. One bad record makes the whole history unavailable.
Our log contained this record, written by the OS in March 2019 (it sits between a 2019-03-13 entry and a 2019-03-29 entry):
1969 Dec 31 17:00:00|0|nan B/s||
The date is Unix time 0 in local time (UTC-7), the duration is 0, the speed is nan B/s, and both the status and errors fields are empty. It looks like an old release logged a check that never actually started.
ParityService.getParityHistory() (api/src/unraid-api/graph/resolvers/array/parity.service.ts, unchanged on main) already guards the date and the duration against bad values, but not the errors field:
const [date, duration, speed, status, errors = '0'] = line.split('|');
...
errors: Number.parseInt(errors, 10),
The = '0' default only applies when the field is missing. Here the field is present but empty, so parseInt('') returns NaN, and GraphQL rejects the whole response because ParityCheck.errors is an Int.
Steps to Reproduce
- Add a record with an empty fifth field to
/boot/config/parity-checks.log, for example1969 Dec 31 17:00:00|0|nan B/s||. - Run
query { parityHistory { date duration speed status errors } }. - The query returns no data.
Expected Behavior
The history is returned. The bad record is either skipped or returned with errors: null (the field is already nullable in the schema), the same way bad dates and durations are already handled.
Actual Behavior
{"errors":[{"message":"Int cannot represent non-integer value: NaN", ...}]}
Removing just that one line from the log (all other 161 records unchanged) makes the same query return all 161 records, which confirms the cause.
Additional Context
Suggested fix, matching the existing duration handling:
const errorsNumber = Number.parseInt(errors, 10);
...
errors: Number.isNaN(errorsNumber) ? undefined : errorsNumber,
Servers that have been upgraded from older releases may carry records like this without knowing it.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 123
- Forks
- 25
- Ø Merge
- 2 T. 16 Std.
- Gemergte PRs (30 T.)
- 9
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus unraid/api
-
Temperature metrics: lm-sensors voltages, fan speeds and power are reported as temperatures (°C)Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
flash { guid } always fails: resolver no longer returns guid but the schema marks it non-nullableOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
Maintainer antworten meist innerhalb von 1 Tag
Ähnliche Issues
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
yavorsky/unbuilt.app#65 ·
-
CVE security
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
mckinsey/agents-at-scale-ark#4091 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
factory:subtask
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 94/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
NUS-Project-SaBai/project-sabai#386 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
android needs clarification
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
super-productivity/super-productivity#12105 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag