Repository navigation
Commit f7d4ed6
committed
fix(daemon): make the liveness probe's health answer a fresh connection's status line
Two review findings about the same question: what may the HTTP leg count as an
answer that forbids a reset?
- Keep-alive reuse (valid). `http.globalAgent` has had `keepAlive: true` since
Node 19, so the leg inherited a pool it was never meant to have: a second
command's probe rides the idle socket an earlier /health read left behind,
and the module header's claim that the probe asks on FRESH connections — the
timed-out connection being the one the transport already tore down — was
silently false. Worse than a stale reading: a pooled socket the daemon had
half torn down answers nothing, the verdict goes negative, and a live shared
daemon is SIGKILLed. That is #3177 reintroduced by the recovery path, so
`agent: false` is load-bearing and said so at the request.
- Body stall (valid against c71b306, already reverted). A body-reading health
helper treats a daemon that sends headers and stalls mid-response as silent.
The reverted reuse restored this leg to its own request, whose response
callback fires on headers, so production was not affected — but nothing
pinned WHY the leg settles there, and the same suggestion will come back.
Each finding now has a regression test whose assertion fails under the
mutation it forbids: waiting for the response's `end` (verified: the stall
test fails), and dropping `agent: false` (verified: the reuse test fails).
The stall test needs `flushHeaders()` to mean anything: Node buffers headers
with the first body chunk, so a handler that only writes a status line never
delivers one and the leg would have nothing to settle on. The reuse test primes
the pool through the very module object the probe loads —
`loadNodeHttpRequester('http:')` resolves real `node:http` — so the pool holds a
candidate, and discriminates on the server seeing the same socket object twice.1 parent eb10231 commit f7d4ed6
2 files changed
Lines changed: 81 additions & 1 deletion
File tree
- src/daemon-client
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
94 | 170 | | |
95 | 171 | | |
96 | 172 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
97 | 101 | | |
98 | 102 | | |
99 | 103 | | |
| |||
0 commit comments