A records.snap stat with a configuration variable's name aborts startup

Offen
#14,181 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 2 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
48/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
cpp
Bereich
backend

Rechercherichtung

Start in src/records/RecCore.cc, especially register_record() around the assertion linked in the issue. Trace how RecReadStatsFile() restores snapshot records before registration, and distinguish records restored from the snapshot from records registered with the wrong kind. Reproduce with the described records.snap entry and verify that startup succeeds for the restored record while the assertion still catches an explicitly misregistered record.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Bug Records

RecReadStatsFile() runs inside RecCoreInit(), before any record is registered, so every stat in records.snap is restored as a new record under its stored name and kind. When the name belongs to a configuration variable, the later registration of that variable finds the restored stat and stops at the release assertion in register_record() (RecCore.cc):

Fatal: src/records/RecCore.cc:75: failed assertion `REC_TYPE_IS_CONFIG(r->rec_type)`

To reproduce, write a records.snap whose one element is a well-formed RECT_PROCESS, RECD_INT record named proxy.config.diags.debug.enabled, with the current version bytes, into the runtime directory, then run traffic_layout info (or start traffic_server). Both abort with SIGABRT. This happens on current master and with #14147 applied: the record is a valid stat, so the reader has no reason to reject it.

Nothing ATS writes puts a configuration name in the snapshot, so this takes a hand-made or damaged file, or a stat that a plugin or an older release registered under a name that is now a configuration variable. It is release-asserted, so a Release build stops too.

The reader cannot reject this without knowing every configuration name, plugin ones included. The place to fix it is register_record(): a record that was only restored from the snapshot, and never registered, should take the kind it is now registered with instead of asserting. The assertion should still hold for a record that some code really did register as the other kind. That changes how every record is registered, not only restored ones, so it is kept out of #14147.

Found during review of #14147.

Vorherrschende Sprache
C++
Sterne
2k
Forks
903
Ø Merge
4 T. 4 Std.
Gemergte PRs (30 T.)
135

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus apache/trafficserver

Alle Issues in apache/trafficserver

Ähnliche Issues

Weitere Issues zu C++

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.