next-leak 0.4.3 → 0.5.1
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/dist/{chunk-EQ2DV2YO.js → chunk-KJFYTJCF.js} +14 -9
- package/dist/cli.js +1 -1
- package/dist/control-client.d.ts +8 -0
- package/dist/index.js +1 -1
- package/dist/load.d.ts +0 -6
- package/package.json +1 -1
|
@@ -92203,6 +92203,7 @@ var LaunchError = class extends Error {
|
|
|
92203
92203
|
}
|
|
92204
92204
|
};
|
|
92205
92205
|
var activeChildren = /* @__PURE__ */ new Set();
|
|
92206
|
+
var STDERR_WINDOW = 4096;
|
|
92206
92207
|
function killActiveChildren() {
|
|
92207
92208
|
for (const child of activeChildren) {
|
|
92208
92209
|
child.kill("SIGKILL");
|
|
@@ -92267,17 +92268,25 @@ async function launchInstrumented(options) {
|
|
|
92267
92268
|
stdio: ["ignore", "ignore", "pipe"]
|
|
92268
92269
|
}
|
|
92269
92270
|
);
|
|
92270
|
-
let
|
|
92271
|
+
let stderrHead = "";
|
|
92272
|
+
let stderrTailBuffer = "";
|
|
92271
92273
|
child.stderr?.on("data", (chunk) => {
|
|
92272
|
-
|
|
92274
|
+
const text = chunk.toString();
|
|
92275
|
+
if (stderrHead.length < STDERR_WINDOW) {
|
|
92276
|
+
stderrHead = (stderrHead + text).slice(0, STDERR_WINDOW);
|
|
92277
|
+
}
|
|
92278
|
+
stderrTailBuffer = (stderrTailBuffer + text).slice(-STDERR_WINDOW);
|
|
92273
92279
|
});
|
|
92280
|
+
const stderrWindow = () => stderrHead === stderrTailBuffer || stderrTailBuffer === "" ? stderrHead : `${stderrHead}
|
|
92281
|
+
[...]
|
|
92282
|
+
${stderrTailBuffer}`;
|
|
92274
92283
|
let exited = false;
|
|
92275
92284
|
activeChildren.add(child);
|
|
92276
92285
|
child.once("exit", () => {
|
|
92277
92286
|
exited = true;
|
|
92278
92287
|
activeChildren.delete(child);
|
|
92279
92288
|
});
|
|
92280
|
-
const failed = () => exited ? `server exited before becoming ready. ${explainStartupFailure(
|
|
92289
|
+
const failed = () => exited ? `server exited before becoming ready. ${explainStartupFailure(stderrWindow())}` : void 0;
|
|
92281
92290
|
try {
|
|
92282
92291
|
const controlPort = await pollUntil(
|
|
92283
92292
|
deadline,
|
|
@@ -92327,7 +92336,7 @@ async function launchInstrumented(options) {
|
|
|
92327
92336
|
pid: child.pid ?? -1,
|
|
92328
92337
|
appPort: options.appPort,
|
|
92329
92338
|
controlPort,
|
|
92330
|
-
explainExit: () => exited ? explainRuntimeFailure(
|
|
92339
|
+
explainExit: () => exited ? explainRuntimeFailure(stderrWindow(), options.maxOldSpaceMb ?? DEFAULT_MAX_OLD_SPACE_MB) : null,
|
|
92331
92340
|
close: async () => {
|
|
92332
92341
|
if (exited) {
|
|
92333
92342
|
return;
|
|
@@ -93208,9 +93217,6 @@ async function runLoadPhase(options) {
|
|
|
93208
93217
|
amount: options.amount,
|
|
93209
93218
|
connections: options.connections,
|
|
93210
93219
|
...options.headers !== void 0 && { headers: options.headers },
|
|
93211
|
-
...options.abandonAfterMs !== void 0 && {
|
|
93212
|
-
timeout: Math.max(Math.ceil(options.abandonAfterMs / 1e3), 1)
|
|
93213
|
-
},
|
|
93214
93220
|
...unique && { idReplacement: true }
|
|
93215
93221
|
});
|
|
93216
93222
|
const result = {
|
|
@@ -93221,8 +93227,7 @@ async function runLoadPhase(options) {
|
|
|
93221
93227
|
timeouts: raw.timeouts,
|
|
93222
93228
|
durationSeconds: raw.duration
|
|
93223
93229
|
};
|
|
93224
|
-
const
|
|
93225
|
-
const failures = Math.max(options.amount - result.ok2xx - expected, 0);
|
|
93230
|
+
const failures = Math.max(options.amount - result.ok2xx, 0);
|
|
93226
93231
|
const ratio = options.amount === 0 ? 0 : failures / options.amount;
|
|
93227
93232
|
if (ratio > (options.maxErrorRatio ?? 0.01)) {
|
|
93228
93233
|
const unanswered = failures - result.non2xx - result.errors - result.timeouts;
|
package/dist/cli.js
CHANGED
package/dist/control-client.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { HeapSample } from "./control-server.js";
|
|
2
|
+
declare function deadlineFor(pathname: string): number;
|
|
2
3
|
declare function request(port: number, pathname: string, deadlineMs?: number): Promise<unknown>;
|
|
3
4
|
/** Forces GC in the measured process and returns a settled memory sample. */
|
|
4
5
|
export declare function requestGc(port: number): Promise<HeapSample>;
|
|
@@ -14,4 +15,11 @@ export declare function requestSnapshot(port: number, name: string): Promise<{
|
|
|
14
15
|
}>;
|
|
15
16
|
/** Test seam: the production deadlines would make a hung-server test take minutes. */
|
|
16
17
|
export declare const requestWithDeadline: typeof request;
|
|
18
|
+
/**
|
|
19
|
+
* Test seam for the deadline table itself. A mutation run showed the mapping
|
|
20
|
+
* could quietly send `/snapshot?name=x` to the 30-second default instead of
|
|
21
|
+
* its 30-minute bound — reinstating, from the inside, the exact ceiling this
|
|
22
|
+
* client exists to remove.
|
|
23
|
+
*/
|
|
24
|
+
export declare const deadlineForOperation: typeof deadlineFor;
|
|
17
25
|
export {};
|
package/dist/index.js
CHANGED
package/dist/load.d.ts
CHANGED
|
@@ -5,12 +5,6 @@ export type LoadPhaseOptions = {
|
|
|
5
5
|
connections: number;
|
|
6
6
|
/** Sent with every request (compression, cookies, auth). */
|
|
7
7
|
headers?: Record<string, string>;
|
|
8
|
-
/**
|
|
9
|
-
* Give up on each request after this many milliseconds, emulating clients
|
|
10
|
-
* that disconnect before the response arrives. Abandoned requests are
|
|
11
|
-
* expected, so they do not count against the error budget.
|
|
12
|
-
*/
|
|
13
|
-
abandonAfterMs?: number;
|
|
14
8
|
/**
|
|
15
9
|
* Maximum tolerated ratio of non-2xx responses plus socket errors before
|
|
16
10
|
* the phase fails. A route that errors under load must fail the run, not
|