parityHistory query fails with NaN when a parity-checks.log record has an empty errors field
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 82/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- graphql, typescript
Direzione di ricerca
Inizia in api/src/unraid-api/graph/resolvers/array/parity.service.ts, in getParityHistory(), dove ogni riga di parity-checks.log viene divisa su '|' e il campo errors passa da Number.parseInt. Data e durata hanno già dei controlli, quindi usa lo stesso schema per errors. Per riprodurre, aggiungi la riga errata 1969 Dec 31 17:00:00|0|nan B/s|| a un log di test ed esegui la query parityHistory. È completato quando tutti i record vengono restituiti e quello errato ha errors pari a null oppure viene saltato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- TypeScript
- Stelle
- 123
- Fork
- 25
- Merge medio
- 2g 16h
- PR unite (30g)
- 9
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di unraid/api
-
Temperature metrics: lm-sensors voltages, fan speeds and power are reported as temperatures (°C)Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
flash { guid } always fails: resolver no longer returns guid but the schema marks it non-nullableAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Bug Nethernet Tests
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
JSPrismarine/JSPrismarine#3949 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
withkarann/aifoxx#504 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 2 giorni