PrometheusSimple: per-host connection slot leaks when TimeoutThread lands in the close handler
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- haskell, prometheus
- Ambito
- observability
Direzione di ricerca
Start with hermod-tracing-prometheus/src/Hermod/Tracing/Prometheus/NetworkRun.hs, especially the forkFinally close handler and the connection-limiter paths at L143–L164; then read how withHandleKillThread and gracefulClose handle timeout exceptions. The issue reports no deterministic reproduction or named test, so first establish a reproducible case. Done means a late timeout cannot leak a per-host or global connection slot and subsequent scrapes are not refused.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
cardano-node 11.2.0.164 (git rev b004fe0c), trace-dispatcher 2.13.1, network 3.2.9.0, time-manager 0.3.2; Leios prototype testnet, block producer.
Observed
After brief whole-process pauses (major GC under memory pressure), the node's stderr shows:
cardano-node: Thread killed by timeout manager
The BP logged this line five times in one day. After the fifth, every scrape from our Prometheus host is refused at once (read: connection reset by peer, ~2 ms). The same endpoint answers 200 to any other host. Inside the container's network namespace, ss -tn '( sport = :12798 )' shows only the listener and no open connections. The refusal persists (35+ minutes so far) while the node keeps running normally. A same-version node on another host with no pauses logged zero such lines and had zero failed scrapes.
Code path (trace-dispatcher-2.13.1, Cardano/Logging/Prometheus/NetworkRun.hs; unchanged on hermod-tracing master in hermod-tracing-prometheus/src/Hermod/Tracing/Prometheus/NetworkRun.hs)
- L90:
forkFinally (runServer mgr conn) (const $ gclose conn >> releasePeer peer).releasePeerruns only ifgclosereturns normally. - L96:
runServerusesT.withHandleKillThread. In time-manager 0.3.2, the kill fires asforkIO $ E.throwTo tid' TimeoutThread(registerKillThread).canceldoes not recall a throw already forked. - The
ignore TimeoutThreadhandler covers only the body ofwithHandleKillThread. A late throw is delivered in theforkFinallyhandler, which runs undermask(interruptible).gracefulCloseblocks inatomically(network 3.2.9.0,recvEOFevent), which is an interruptible point. The exception then abortsgclose, skipsreleasePeer, and escapes the thread. That escape is the stderr line above. - L159/L164: with
runConnLimitPerHost = 5, the fifth leaked slot for a peer address meanscanServeThisPeerreturnsFalse. L91 then callsclose connon every later connection from that address, which the client sees as RST/EOF.
A process-wide pause makes the race likely: the inactivity timer and the client's close are both pending when the RTS resumes.
Impact
Metrics from one monitoring host are lost until the node restarts, while the node itself is healthy. With connCountPerHost = 0 and a non-zero global limit, the same leak would count against runConnLimitGlobal (L153), so every host would be refused instead.
Workaround (from code; not tested on a live node)
Set "TracePrometheusSimpleRun": {"connCountGlobal": 0, "connCountPerHost": 0}. mkConnLimiter 0 0 (L143) disables the limiter. cardano-node passes this to runPrometheusSimpleWith (cardano-node/src/Cardano/Node/Tracing/API.hs:175-177 at b004fe0c). Alternatively, restart the node.
Not verified
- The exact interleaving. It is inferred from the code and from the one-to-one match between the stderr lines and the leaked slots. There is no deterministic reproduction yet.
- The workaround on a running node.
Related: IntersectMBO/cardano-node#6389 (same symptom; closed after #6396 added withHandleKillThread).
- Lingua principale
- Haskell
- Stelle
- 0
- Fork
- 2
- Merge medio
- 3g 23h
- PR unite (30g)
- 4
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna 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.
Issue simili
-
Allow QuickCheck 2.17Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
-
15-minutes 5-minutes algorithm any-language beginner-friendly c cpp csharp easy go good first issue hacktoberfest help wanted java javascript kotlin python rust swift typescript
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
Huerte/algo-solutions-python#260 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
IntersectMBO/cardano-ledger#6276 ·
I maintainer di solito rispondono entro 1 giorno