maxpool 1.24.17 → 1.24.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/restart-controller.js +11 -8
- package/src/server.js +30 -1
package/package.json
CHANGED
|
@@ -87,17 +87,20 @@ export class RestartController {
|
|
|
87
87
|
// Without the `pending` guard a second call (e.g. auto-apply firing while a manual
|
|
88
88
|
// restart is draining) would orphan the first _drainTimer and re-log.
|
|
89
89
|
if (this.restarting || this.pending) return;
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
// Seamless handoff → do not pre-drain AND do not pause admission. The old worker
|
|
91
|
+
// keeps serving everything it already holds after the baton passes — including
|
|
92
|
+
// requests WAITING in its queue. Pausing admission made the routing oracle report
|
|
93
|
+
// "no route will ever recover", so every queued waiter gave up at once: the
|
|
94
|
+
// v1.24.18 auto-update dropped 24 sessions that had waited 3-13 min (2026-10-11).
|
|
95
|
+
if (this.isSeamless()) {
|
|
96
|
+
if (this.upstreamRequests.size > 0) {
|
|
97
|
+
this.log(`[Maxpool] Restarting now — ${this.upstreamRequests.size} in-flight request(s) finish on the current version; new requests go to the updated one.`);
|
|
98
|
+
}
|
|
92
99
|
this._restart();
|
|
93
100
|
return;
|
|
94
101
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
// requests finish on the OLD worker after the baton passes; holding admission
|
|
98
|
-
// here would only 503 the rest of the fleet for nothing.
|
|
99
|
-
if (this.isSeamless()) {
|
|
100
|
-
this.log(`[Maxpool] Restarting now — ${this.upstreamRequests.size} in-flight request(s) finish on the current version; new requests go to the updated one.`);
|
|
102
|
+
this.pauseAdmission();
|
|
103
|
+
if (this.upstreamRequests.size === 0) {
|
|
101
104
|
this._restart();
|
|
102
105
|
return;
|
|
103
106
|
}
|
package/src/server.js
CHANGED
|
@@ -163,7 +163,14 @@ export function createProxyServer(accountManager, config, hooks = {}) {
|
|
|
163
163
|
// upstream-bound request headers elsewhere.
|
|
164
164
|
const workerStamp = String(process.pid);
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
// REQUEST-ARRIVAL TIMEOUTS (2026-10-11 outage). Node's defaults (300s request
|
|
167
|
+
// timeout, 30s checking interval) are what fired live — but they must be in the
|
|
168
|
+
// constructor to be settable at all (property assignment after listen is a no-op
|
|
169
|
+
// in Node 20, measured), so they are read here, env-tunable, never mutated later.
|
|
170
|
+
const server = http.createServer({
|
|
171
|
+
requestTimeout: Math.max(1_000, Number(process.env.MAXPOOL_REQUEST_TIMEOUT_MS) || 300_000),
|
|
172
|
+
connectionsCheckingInterval: Math.max(100, Number(process.env.MAXPOOL_CONNECTIONS_CHECK_MS) || 30_000),
|
|
173
|
+
}, async (req, res) => {
|
|
167
174
|
try {
|
|
168
175
|
// Disable Nagle on the client socket: flush each SSE event immediately instead
|
|
169
176
|
// of coalescing small writes into bursts. Smooths streaming cadence toward the
|
|
@@ -343,6 +350,28 @@ export function createProxyServer(accountManager, config, hooks = {}) {
|
|
|
343
350
|
// this releasing worker.
|
|
344
351
|
server.maxpoolBeginDrain = () => { draining = true; };
|
|
345
352
|
|
|
353
|
+
// STALLED-UPLOAD ANSWER (2026-10-11 outage). When a request body never finishes
|
|
354
|
+
// arriving, Node's requestTimeout fires and its default handler writes a BODY-LESS
|
|
355
|
+
// `408 Request Timeout`, which Claude Code surfaces as the opaque "API Error: 408
|
|
356
|
+
// status code (no body)" (1,711 of them overnight, while the Mac's network stack
|
|
357
|
+
// was starved). Answer with the standard Anthropic error envelope instead, naming
|
|
358
|
+
// the actual cause, so the user sees a real message and the CLI treats it like any
|
|
359
|
+
// other retryable API error. Every other client error keeps Node's own handling.
|
|
360
|
+
server.on('clientError', (err, socket) => {
|
|
361
|
+
if (err?.code === 'ERR_HTTP_REQUEST_TIMEOUT' && socket.writable && !socket._httpMessage?.headersSent) {
|
|
362
|
+
const body = JSON.stringify({
|
|
363
|
+
type: 'error',
|
|
364
|
+
error: {
|
|
365
|
+
type: 'request_timeout',
|
|
366
|
+
message: 'Maxpool did not receive the full request in time (the upload stalled — usually a network problem on this machine). Retrying should work once the network recovers.',
|
|
367
|
+
},
|
|
368
|
+
});
|
|
369
|
+
socket.end(`HTTP/1.1 408 Request Timeout\r\nContent-Type: application/json\r\nContent-Length: ${Buffer.byteLength(body)}\r\nConnection: close\r\n\r\n${body}`);
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
socket.destroy(err);
|
|
373
|
+
});
|
|
374
|
+
|
|
346
375
|
return server;
|
|
347
376
|
}
|
|
348
377
|
|