camstack 1.2.49 → 1.2.50
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/cli.js
CHANGED
|
@@ -38,7 +38,7 @@ async function runServe(args) {
|
|
|
38
38
|
...typeof values.data === "string" ? { data: values.data } : {}
|
|
39
39
|
};
|
|
40
40
|
Object.assign(process.env, buildServeEnv(opts));
|
|
41
|
-
await import("./launcher-
|
|
41
|
+
await import("./launcher-5GF42UWL.js");
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
// src/commands/agent.ts
|
|
@@ -83,7 +83,7 @@ async function runAgent(args) {
|
|
|
83
83
|
...typeof values.port === "string" ? { port: values.port } : {}
|
|
84
84
|
};
|
|
85
85
|
Object.assign(process.env, buildAgentEnv(opts));
|
|
86
|
-
await import("./launcher-
|
|
86
|
+
await import("./launcher-5GF42UWL.js");
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
// src/commands/setup.ts
|
|
@@ -111785,9 +111785,9 @@ var require_dist2 = __commonJS({
|
|
|
111785
111785
|
}
|
|
111786
111786
|
});
|
|
111787
111787
|
|
|
111788
|
-
// ../system/dist/manifest-python-deps-
|
|
111789
|
-
var
|
|
111790
|
-
"../system/dist/manifest-python-deps-
|
|
111788
|
+
// ../system/dist/manifest-python-deps-CktMcXzS.js
|
|
111789
|
+
var require_manifest_python_deps_CktMcXzS = __commonJS({
|
|
111790
|
+
"../system/dist/manifest-python-deps-CktMcXzS.js"(exports) {
|
|
111791
111791
|
"use strict";
|
|
111792
111792
|
var require_chunk = require_chunk_Cek0wNdY();
|
|
111793
111793
|
require_dist_BVU5JADq();
|
|
@@ -111881,6 +111881,34 @@ var require_manifest_python_deps_GjlyPjm0 = __commonJS({
|
|
|
111881
111881
|
function shouldReclaim(s, triggerMb = HEAP_RECLAIM_TRIGGER_MB) {
|
|
111882
111882
|
return strandedMb(s) > triggerMb;
|
|
111883
111883
|
}
|
|
111884
|
+
function share(partMb, rssMb) {
|
|
111885
|
+
return rssMb > 0 ? Math.round(partMb / rssMb * 100) : 0;
|
|
111886
|
+
}
|
|
111887
|
+
function describeRss(s, budgetMb) {
|
|
111888
|
+
const nativeResidueMb = Math.max(0, strandedMb(s));
|
|
111889
|
+
const shape = s.heapUsedMb >= s.externalMb && s.heapUsedMb >= nativeResidueMb ? "v8-heap" : s.externalMb >= nativeResidueMb ? "external" : "native-residue";
|
|
111890
|
+
return {
|
|
111891
|
+
rssMb: s.rssMb,
|
|
111892
|
+
budgetMb,
|
|
111893
|
+
overMb: Math.max(0, s.rssMb - budgetMb),
|
|
111894
|
+
heapUsedMb: s.heapUsedMb,
|
|
111895
|
+
externalMb: s.externalMb,
|
|
111896
|
+
nativeResidueMb,
|
|
111897
|
+
arrayBuffersMb: s.arrayBuffersMb,
|
|
111898
|
+
shape
|
|
111899
|
+
};
|
|
111900
|
+
}
|
|
111901
|
+
var SHAPE_ADVICE = {
|
|
111902
|
+
"v8-heap": "live JS retainers \u2014 bounded by --max-old-space-size; the fix is the retained set",
|
|
111903
|
+
external: "Buffers / native external \u2014 NO V8 flag bounds this, and the old-space ceiling never will",
|
|
111904
|
+
"native-residue": "freed native memory the allocator has not returned \u2014 MALLOC_ARENA_MAX/VIPS_CONCURRENCY are already applied, so this lever is spent"
|
|
111905
|
+
};
|
|
111906
|
+
var RSS_BUDGET_RELEASE_RATIO = 0.9;
|
|
111907
|
+
var RSS_BUDGET_REANNOUNCE_MIN_MS = 9e5;
|
|
111908
|
+
function nextRssBudgetState(current, rssMb, budgetMb, releaseRatio = RSS_BUDGET_RELEASE_RATIO) {
|
|
111909
|
+
if (current === "over") return rssMb < budgetMb * releaseRatio ? "within" : "over";
|
|
111910
|
+
return rssMb > budgetMb ? "over" : "within";
|
|
111911
|
+
}
|
|
111884
111912
|
function isGcFunction(value) {
|
|
111885
111913
|
return typeof value === "function";
|
|
111886
111914
|
}
|
|
@@ -111898,12 +111926,15 @@ var require_manifest_python_deps_GjlyPjm0 = __commonJS({
|
|
|
111898
111926
|
return;
|
|
111899
111927
|
}
|
|
111900
111928
|
}
|
|
111901
|
-
function
|
|
111902
|
-
|
|
111929
|
+
function formatOverBudget(label, b, source) {
|
|
111930
|
+
return `[mem] ${label} OVER RSS BUDGET rss=${b.rssMb}MB budget=${b.budgetMb}MB over=+${b.overMb}MB shape=${b.shape} heapUsed=${b.heapUsedMb}MB(${share(b.heapUsedMb, b.rssMb)}%) external=${b.externalMb}MB(${share(b.externalMb, b.rssMb)}%) nativeResidue=${b.nativeResidueMb}MB(${share(b.nativeResidueMb, b.rssMb)}%) arrayBuffers=${b.arrayBuffersMb}MB budgetFrom="${source}" \u2014 ${SHAPE_ADVICE[b.shape]}`;
|
|
111931
|
+
}
|
|
111932
|
+
function format2(label, s, loop, budgetMb) {
|
|
111933
|
+
const line = `[mem] ${label} rss=${s.rssMb}MB heapUsed=${s.heapUsedMb}MB heapTotal=${s.heapTotalMb}MB heapLimit=${s.heapLimitMb}MB used=${Math.round(s.usedRatio * 100)}% external=${s.externalMb}MB arrayBuffers=${s.arrayBuffersMb}MB` + (budgetMb === void 0 ? "" : ` rssBudget=${budgetMb}MB`);
|
|
111903
111934
|
if (loop === void 0) return line;
|
|
111904
111935
|
return `${line} loopP50=${loop.p50Ms}ms loopP99=${loop.p99Ms}ms loopMax=${loop.maxMs}ms`;
|
|
111905
111936
|
}
|
|
111906
|
-
function startHeapWatch(label = "hub-main", sink = consoleSink, intervalMs = HEAP_WATCH_INTERVAL_MS, reclaimOptions, loopDelay = createLoopDelayMeter(), execArgv = process.execArgv, announceCeilingOrigin = true) {
|
|
111937
|
+
function startHeapWatch(label = "hub-main", sink = consoleSink, intervalMs = HEAP_WATCH_INTERVAL_MS, reclaimOptions, loopDelay = createLoopDelayMeter(), execArgv = process.execArgv, announceCeilingOrigin = true, rssBudget) {
|
|
111907
111938
|
const readMemory = reclaimOptions?.readMemory ?? (() => process.memoryUsage());
|
|
111908
111939
|
const now = reclaimOptions?.now ?? (() => Date.now());
|
|
111909
111940
|
const triggerMb = reclaimOptions?.triggerMb ?? 1024;
|
|
@@ -111945,6 +111976,29 @@ var require_manifest_python_deps_GjlyPjm0 = __commonJS({
|
|
|
111945
111976
|
};
|
|
111946
111977
|
let mode = "steady";
|
|
111947
111978
|
let lastLoggedAt = Number.NEGATIVE_INFINITY;
|
|
111979
|
+
const budgetMb = rssBudget?.budgetMb !== void 0 && rssBudget.budgetMb > 0 ? rssBudget.budgetMb : void 0;
|
|
111980
|
+
const budgetSource = rssBudget?.source ?? "unspecified";
|
|
111981
|
+
const releaseRatio = rssBudget?.releaseRatio ?? 0.9;
|
|
111982
|
+
const reannounceMinMs = rssBudget?.reannounceMinMs ?? 9e5;
|
|
111983
|
+
let budgetState = "within";
|
|
111984
|
+
let lastBudgetWarnAt = Number.NEGATIVE_INFINITY;
|
|
111985
|
+
let overBudgetAnnounced = false;
|
|
111986
|
+
const checkRssBudget = (sample, at) => {
|
|
111987
|
+
if (budgetMb === void 0) return;
|
|
111988
|
+
const previous = budgetState;
|
|
111989
|
+
budgetState = nextRssBudgetState(previous, sample.rssMb, budgetMb, releaseRatio);
|
|
111990
|
+
if (budgetState === previous) return;
|
|
111991
|
+
if (budgetState === "over") {
|
|
111992
|
+
if (at - lastBudgetWarnAt < reannounceMinMs) return;
|
|
111993
|
+
lastBudgetWarnAt = at;
|
|
111994
|
+
overBudgetAnnounced = true;
|
|
111995
|
+
sink.warn(formatOverBudget(label, describeRss(sample, budgetMb), budgetSource));
|
|
111996
|
+
return;
|
|
111997
|
+
}
|
|
111998
|
+
if (!overBudgetAnnounced) return;
|
|
111999
|
+
overBudgetAnnounced = false;
|
|
112000
|
+
sink.info(`[mem] ${label} back within its RSS budget \u2014 rss=${sample.rssMb}MB budget=${budgetMb}MB`);
|
|
112001
|
+
};
|
|
111948
112002
|
const probeIntervalMs = Math.min(fastIntervalMs, intervalMs);
|
|
111949
112003
|
const tick = () => {
|
|
111950
112004
|
try {
|
|
@@ -111955,12 +112009,13 @@ var require_manifest_python_deps_GjlyPjm0 = __commonJS({
|
|
|
111955
112009
|
const due = at - lastLoggedAt >= intervalMs;
|
|
111956
112010
|
if (mode === "escalated" || due) {
|
|
111957
112011
|
lastLoggedAt = at;
|
|
111958
|
-
const line = format2(label, sample, loopDelay?.read());
|
|
112012
|
+
const line = format2(label, sample, loopDelay?.read(), budgetMb);
|
|
111959
112013
|
if (sample.nearLimit) sink.warn(`${line} \u2014 APPROACHING HEAP LIMIT`);
|
|
111960
112014
|
else if (mode === "escalated") sink.warn(`${line} \u2014 heap elevated, sampling every ${probeIntervalMs}ms`);
|
|
111961
112015
|
else sink.info(line);
|
|
111962
112016
|
}
|
|
111963
112017
|
if (previous === "escalated" && mode === "steady") sink.info(`[mem] ${label} heap back to routine \u2014 logging every ${intervalMs}ms`);
|
|
112018
|
+
checkRssBudget(sample, at);
|
|
111964
112019
|
maybeReclaim(sample);
|
|
111965
112020
|
} catch {
|
|
111966
112021
|
}
|
|
@@ -111968,6 +112023,7 @@ var require_manifest_python_deps_GjlyPjm0 = __commonJS({
|
|
|
111968
112023
|
const timer = setInterval(tick, probeIntervalMs);
|
|
111969
112024
|
timer.unref?.();
|
|
111970
112025
|
tick();
|
|
112026
|
+
if (rssBudget !== void 0 && budgetMb === void 0) sink.info(`[mem] ${label} is NOT WATCHED against an RSS budget \u2014 no budget declared (${budgetSource}). rss growth outside the V8 heap raises nothing here: --max-old-space-size bounds old space only, and stranded subtracts external by construction. Declare execution.rssBudgetMb once this process has a measured working set.`);
|
|
111971
112027
|
if (announceCeilingOrigin && heapCeilingOrigin(execArgv) === "v8-default") sink.info(`[mem] ${label} heap ceiling is V8's DEFAULT (${read().heapLimitMb}MB) \u2014 no --max-old-space-size on argv. Nothing here CHOSE that number; it is derived from host RAM and moves with it.`);
|
|
111972
112028
|
let stopped = false;
|
|
111973
112029
|
return () => {
|
|
@@ -111978,16 +112034,40 @@ var require_manifest_python_deps_GjlyPjm0 = __commonJS({
|
|
|
111978
112034
|
};
|
|
111979
112035
|
}
|
|
111980
112036
|
var RUNNER_HEAP_WATCH_INTERVAL_MS = 3e5;
|
|
112037
|
+
function parseRssBudgetMb(raw) {
|
|
112038
|
+
if (raw === void 0) return void 0;
|
|
112039
|
+
const parsed = Number(raw);
|
|
112040
|
+
if (!Number.isFinite(parsed) || parsed <= 0) return void 0;
|
|
112041
|
+
return Math.floor(parsed);
|
|
112042
|
+
}
|
|
112043
|
+
var RUNNER_RSS_BUDGET_ENV = "CAMSTACK_RUNNER_RSS_BUDGET_MB";
|
|
112044
|
+
var HUB_RSS_BUDGET_ENV = "CAMSTACK_HUB_RSS_BUDGET_MB";
|
|
112045
|
+
var HUB_MAIN_RSS_BUDGET_MB = 4096;
|
|
112046
|
+
function hubMainRssBudget(env = process.env) {
|
|
112047
|
+
const override = env[HUB_RSS_BUDGET_ENV];
|
|
112048
|
+
if (override !== void 0) return {
|
|
112049
|
+
budgetMb: parseRssBudgetMb(override),
|
|
112050
|
+
source: HUB_RSS_BUDGET_ENV
|
|
112051
|
+
};
|
|
112052
|
+
return {
|
|
112053
|
+
budgetMb: HUB_MAIN_RSS_BUDGET_MB,
|
|
112054
|
+
source: "HUB_MAIN_RSS_BUDGET_MB (kernel/heap-watch)"
|
|
112055
|
+
};
|
|
112056
|
+
}
|
|
111981
112057
|
function startRunnerHeapWatch(options) {
|
|
111982
112058
|
if (options.heapProfile !== "heavy") return void 0;
|
|
111983
112059
|
const intervalMs = options.intervalMs ?? 3e5;
|
|
111984
|
-
|
|
112060
|
+
const rssBudget = {
|
|
112061
|
+
budgetMb: parseRssBudgetMb(options.rssBudgetMb),
|
|
112062
|
+
source: `manifest execution.rssBudgetMb (via ${RUNNER_RSS_BUDGET_ENV})`
|
|
112063
|
+
};
|
|
112064
|
+
if (options.reclaimSwitch === "off") return startHeapWatch(options.label, options.sink, intervalMs, void 0, void 0, void 0, false, rssBudget);
|
|
111985
112065
|
let reclaimOptions = options.reclaimOptions;
|
|
111986
112066
|
if (reclaimOptions === void 0) {
|
|
111987
112067
|
const reclaimer = createV8Reclaimer();
|
|
111988
112068
|
reclaimOptions = reclaimer === void 0 ? void 0 : { reclaim: reclaimer };
|
|
111989
112069
|
}
|
|
111990
|
-
return startHeapWatch(options.label, options.sink, intervalMs, reclaimOptions, void 0, void 0, true);
|
|
112070
|
+
return startHeapWatch(options.label, options.sink, intervalMs, reclaimOptions, void 0, void 0, true, rssBudget);
|
|
111991
112071
|
}
|
|
111992
112072
|
function trimSlashes(s) {
|
|
111993
112073
|
return s.replace(/^\/+/, "").replace(/\/+$/, "");
|
|
@@ -118543,6 +118623,18 @@ var require_manifest_python_deps_GjlyPjm0 = __commonJS({
|
|
|
118543
118623
|
return HUB_CAP_FWD_SERVICE;
|
|
118544
118624
|
}
|
|
118545
118625
|
});
|
|
118626
|
+
Object.defineProperty(exports, "HUB_MAIN_RSS_BUDGET_MB", {
|
|
118627
|
+
enumerable: true,
|
|
118628
|
+
get: function() {
|
|
118629
|
+
return HUB_MAIN_RSS_BUDGET_MB;
|
|
118630
|
+
}
|
|
118631
|
+
});
|
|
118632
|
+
Object.defineProperty(exports, "HUB_RSS_BUDGET_ENV", {
|
|
118633
|
+
enumerable: true,
|
|
118634
|
+
get: function() {
|
|
118635
|
+
return HUB_RSS_BUDGET_ENV;
|
|
118636
|
+
}
|
|
118637
|
+
});
|
|
118546
118638
|
Object.defineProperty(exports, "LocalChildClient", {
|
|
118547
118639
|
enumerable: true,
|
|
118548
118640
|
get: function() {
|
|
@@ -118561,12 +118653,30 @@ var require_manifest_python_deps_GjlyPjm0 = __commonJS({
|
|
|
118561
118653
|
return NATIVE_PROVIDER_SERVICE_INFIX;
|
|
118562
118654
|
}
|
|
118563
118655
|
});
|
|
118656
|
+
Object.defineProperty(exports, "RSS_BUDGET_REANNOUNCE_MIN_MS", {
|
|
118657
|
+
enumerable: true,
|
|
118658
|
+
get: function() {
|
|
118659
|
+
return RSS_BUDGET_REANNOUNCE_MIN_MS;
|
|
118660
|
+
}
|
|
118661
|
+
});
|
|
118662
|
+
Object.defineProperty(exports, "RSS_BUDGET_RELEASE_RATIO", {
|
|
118663
|
+
enumerable: true,
|
|
118664
|
+
get: function() {
|
|
118665
|
+
return RSS_BUDGET_RELEASE_RATIO;
|
|
118666
|
+
}
|
|
118667
|
+
});
|
|
118564
118668
|
Object.defineProperty(exports, "RUNNER_HEAP_WATCH_INTERVAL_MS", {
|
|
118565
118669
|
enumerable: true,
|
|
118566
118670
|
get: function() {
|
|
118567
118671
|
return RUNNER_HEAP_WATCH_INTERVAL_MS;
|
|
118568
118672
|
}
|
|
118569
118673
|
});
|
|
118674
|
+
Object.defineProperty(exports, "RUNNER_RSS_BUDGET_ENV", {
|
|
118675
|
+
enumerable: true,
|
|
118676
|
+
get: function() {
|
|
118677
|
+
return RUNNER_RSS_BUDGET_ENV;
|
|
118678
|
+
}
|
|
118679
|
+
});
|
|
118570
118680
|
Object.defineProperty(exports, "SocketChannel", {
|
|
118571
118681
|
enumerable: true,
|
|
118572
118682
|
get: function() {
|
|
@@ -118771,6 +118881,12 @@ var require_manifest_python_deps_GjlyPjm0 = __commonJS({
|
|
|
118771
118881
|
return createV8Reclaimer;
|
|
118772
118882
|
}
|
|
118773
118883
|
});
|
|
118884
|
+
Object.defineProperty(exports, "describeRss", {
|
|
118885
|
+
enumerable: true,
|
|
118886
|
+
get: function() {
|
|
118887
|
+
return describeRss;
|
|
118888
|
+
}
|
|
118889
|
+
});
|
|
118774
118890
|
Object.defineProperty(exports, "deserializeTypedArrays", {
|
|
118775
118891
|
enumerable: true,
|
|
118776
118892
|
get: function() {
|
|
@@ -118831,6 +118947,12 @@ var require_manifest_python_deps_GjlyPjm0 = __commonJS({
|
|
|
118831
118947
|
return getWorkerNativeCapSnapshot;
|
|
118832
118948
|
}
|
|
118833
118949
|
});
|
|
118950
|
+
Object.defineProperty(exports, "hubMainRssBudget", {
|
|
118951
|
+
enumerable: true,
|
|
118952
|
+
get: function() {
|
|
118953
|
+
return hubMainRssBudget;
|
|
118954
|
+
}
|
|
118955
|
+
});
|
|
118834
118956
|
Object.defineProperty(exports, "installManifestNativeDeps", {
|
|
118835
118957
|
enumerable: true,
|
|
118836
118958
|
get: function() {
|
|
@@ -118867,12 +118989,24 @@ var require_manifest_python_deps_GjlyPjm0 = __commonJS({
|
|
|
118867
118989
|
return mountNativeCapService;
|
|
118868
118990
|
}
|
|
118869
118991
|
});
|
|
118992
|
+
Object.defineProperty(exports, "nextRssBudgetState", {
|
|
118993
|
+
enumerable: true,
|
|
118994
|
+
get: function() {
|
|
118995
|
+
return nextRssBudgetState;
|
|
118996
|
+
}
|
|
118997
|
+
});
|
|
118870
118998
|
Object.defineProperty(exports, "parseCapAction", {
|
|
118871
118999
|
enumerable: true,
|
|
118872
119000
|
get: function() {
|
|
118873
119001
|
return parseCapAction;
|
|
118874
119002
|
}
|
|
118875
119003
|
});
|
|
119004
|
+
Object.defineProperty(exports, "parseRssBudgetMb", {
|
|
119005
|
+
enumerable: true,
|
|
119006
|
+
get: function() {
|
|
119007
|
+
return parseRssBudgetMb;
|
|
119008
|
+
}
|
|
119009
|
+
});
|
|
118876
119010
|
Object.defineProperty(exports, "registerEventBusService", {
|
|
118877
119011
|
enumerable: true,
|
|
118878
119012
|
get: function() {
|
|
@@ -122797,7 +122931,7 @@ var require_dist3 = __commonJS({
|
|
|
122797
122931
|
var require_builtins_winston_logging_index = require_winston_logging();
|
|
122798
122932
|
var require_file_data_plane = require_file_data_plane_DO8KbxCe();
|
|
122799
122933
|
var require_tls$1 = require_tls_u8QCJCFE();
|
|
122800
|
-
var require_manifest_python_deps =
|
|
122934
|
+
var require_manifest_python_deps = require_manifest_python_deps_CktMcXzS();
|
|
122801
122935
|
var require_resource_monitor = require_resource_monitor_CdnzxBLP();
|
|
122802
122936
|
var require_custom_action_registry = require_custom_action_registry_jY0NOZK8();
|
|
122803
122937
|
var zod = require_zod();
|
|
@@ -202263,7 +202397,8 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
|
|
|
202263
202397
|
}
|
|
202264
202398
|
var EMPTY_HEAP_DECLARATION = {
|
|
202265
202399
|
profile: void 0,
|
|
202266
|
-
maxOldSpaceMb: void 0
|
|
202400
|
+
maxOldSpaceMb: void 0,
|
|
202401
|
+
rssBudgetMb: void 0
|
|
202267
202402
|
};
|
|
202268
202403
|
var heapProfileCache = /* @__PURE__ */ new Map();
|
|
202269
202404
|
function readAddonHeapDeclaration(spec) {
|
|
@@ -202276,10 +202411,12 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
|
|
|
202276
202411
|
const parsed = JSON.parse(raw);
|
|
202277
202412
|
const profile = extractHeapProfile(parsed, spec.addonId);
|
|
202278
202413
|
const maxOldSpaceMb = extractMaxOldSpaceMb(parsed, spec.addonId);
|
|
202279
|
-
|
|
202414
|
+
const rssBudgetMb = extractRssBudgetMb(parsed, spec.addonId);
|
|
202415
|
+
if (profile !== void 0 || maxOldSpaceMb !== void 0 || rssBudgetMb !== void 0) {
|
|
202280
202416
|
declaration = {
|
|
202281
202417
|
profile,
|
|
202282
|
-
maxOldSpaceMb
|
|
202418
|
+
maxOldSpaceMb,
|
|
202419
|
+
rssBudgetMb
|
|
202283
202420
|
};
|
|
202284
202421
|
break;
|
|
202285
202422
|
}
|
|
@@ -202303,6 +202440,10 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
|
|
|
202303
202440
|
const value = readManifestAddons(parsed).find((a) => a.id === addonId)?.execution?.maxOldSpaceMb;
|
|
202304
202441
|
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.floor(value) : void 0;
|
|
202305
202442
|
}
|
|
202443
|
+
function extractRssBudgetMb(parsed, addonId) {
|
|
202444
|
+
const value = readManifestAddons(parsed).find((a) => a.id === addonId)?.execution?.rssBudgetMb;
|
|
202445
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.floor(value) : void 0;
|
|
202446
|
+
}
|
|
202306
202447
|
function readManifestAddons(parsed) {
|
|
202307
202448
|
if (typeof parsed !== "object" || parsed === null) return [];
|
|
202308
202449
|
const camstack = parsed.camstack;
|
|
@@ -202321,6 +202462,10 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
|
|
|
202321
202462
|
if (declared.includes(0)) return 0;
|
|
202322
202463
|
return Math.max(...declared);
|
|
202323
202464
|
}
|
|
202465
|
+
function runnerRssBudgetMb(addons) {
|
|
202466
|
+
const declared = addons.map((a) => readAddonHeapDeclaration(a).rssBudgetMb).filter((mb) => mb !== void 0);
|
|
202467
|
+
return declared.length === 0 ? void 0 : Math.max(...declared);
|
|
202468
|
+
}
|
|
202324
202469
|
function runnerHeapFlags(addons) {
|
|
202325
202470
|
if (process.env["CAMSTACK_RUNNER_HEAP_TUNING"] === "off") return [];
|
|
202326
202471
|
const heavy = isHeavyRunner(addons);
|
|
@@ -202377,6 +202522,7 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
|
|
|
202377
202522
|
const nodeId = buildNodeId(runnerId);
|
|
202378
202523
|
const runnerPath = node_path.resolve(__dirname, "addon-runner.js");
|
|
202379
202524
|
const heavy = isHeavyRunner(addons);
|
|
202525
|
+
const rssBudgetMb = runnerRssBudgetMb(addons);
|
|
202380
202526
|
const childEnv = {
|
|
202381
202527
|
...process.env,
|
|
202382
202528
|
CAMSTACK_RUNNER_ID: runnerId,
|
|
@@ -202390,6 +202536,8 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
|
|
|
202390
202536
|
...applyRunnerNativeAllocator(process.env),
|
|
202391
202537
|
...env
|
|
202392
202538
|
};
|
|
202539
|
+
if (rssBudgetMb === void 0) delete childEnv[require_manifest_python_deps.RUNNER_RSS_BUDGET_ENV];
|
|
202540
|
+
else childEnv[require_manifest_python_deps.RUNNER_RSS_BUDGET_ENV] = String(rssBudgetMb);
|
|
202393
202541
|
const heapFlags = runnerHeapFlags(addons);
|
|
202394
202542
|
capturedBroker?.logger.info(`[${runnerId}] heap profile: ${heavy ? "heavy" : "light"} flags=[${heapFlags.join(" ")}] arenas=${childEnv["MALLOC_ARENA_MAX"] ?? "glibc-default"} vips=${childEnv["VIPS_CONCURRENCY"] ?? "sharp-default"}`);
|
|
202395
202543
|
const child = spawnFn(process.execPath, [...heapFlags, runnerPath], {
|
|
@@ -203180,6 +203328,8 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
|
|
|
203180
203328
|
exports.HEAP_WATCH_WARN_RATIO = require_manifest_python_deps.HEAP_WATCH_WARN_RATIO;
|
|
203181
203329
|
exports.HUB_CAP_FWD_ACTION = require_manifest_python_deps.HUB_CAP_FWD_ACTION;
|
|
203182
203330
|
exports.HUB_CAP_FWD_SERVICE = require_manifest_python_deps.HUB_CAP_FWD_SERVICE;
|
|
203331
|
+
exports.HUB_MAIN_RSS_BUDGET_MB = require_manifest_python_deps.HUB_MAIN_RSS_BUDGET_MB;
|
|
203332
|
+
exports.HUB_RSS_BUDGET_ENV = require_manifest_python_deps.HUB_RSS_BUDGET_ENV;
|
|
203183
203333
|
exports.HubForwarderAddon = require_builtins_hub_forwarder_index.HubForwarderAddon$1;
|
|
203184
203334
|
exports.HubForwarderDestination = require_builtins_hub_forwarder_index.HubForwarderDestination$1;
|
|
203185
203335
|
exports.HubLogForwarder = HubLogForwarder;
|
|
@@ -203219,7 +203369,10 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
|
|
|
203219
203369
|
exports.PythonEnvManager = PythonEnvManager;
|
|
203220
203370
|
exports.QUARANTINE_DIRNAME = QUARANTINE_DIRNAME;
|
|
203221
203371
|
exports.RESTART_MARKER_FILE = RESTART_MARKER_FILE;
|
|
203372
|
+
exports.RSS_BUDGET_REANNOUNCE_MIN_MS = require_manifest_python_deps.RSS_BUDGET_REANNOUNCE_MIN_MS;
|
|
203373
|
+
exports.RSS_BUDGET_RELEASE_RATIO = require_manifest_python_deps.RSS_BUDGET_RELEASE_RATIO;
|
|
203222
203374
|
exports.RUNNER_HEAP_WATCH_INTERVAL_MS = require_manifest_python_deps.RUNNER_HEAP_WATCH_INTERVAL_MS;
|
|
203375
|
+
exports.RUNNER_RSS_BUDGET_ENV = require_manifest_python_deps.RUNNER_RSS_BUDGET_ENV;
|
|
203223
203376
|
exports.RUNTIME_DEFAULTS = require_dist10.RUNTIME_DEFAULTS;
|
|
203224
203377
|
exports.ReadinessRegistry = require_dist10.ReadinessRegistry;
|
|
203225
203378
|
exports.ReadinessTimeoutError = require_dist10.ReadinessTimeoutError;
|
|
@@ -203316,6 +203469,7 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
|
|
|
203316
203469
|
exports.deleteModelFromDisk = require_file_data_plane.deleteModelFromDisk;
|
|
203317
203470
|
exports.deriveAgentListenPort = deriveAgentListenPort;
|
|
203318
203471
|
exports.describeProviderKindDrift = describeProviderKindDrift;
|
|
203472
|
+
exports.describeRss = require_manifest_python_deps.describeRss;
|
|
203319
203473
|
exports.detectWorkspacePackagesDir = detectWorkspacePackagesDir;
|
|
203320
203474
|
Object.defineProperty(exports, "downloadBinary", {
|
|
203321
203475
|
enumerable: true,
|
|
@@ -203392,6 +203546,7 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
|
|
|
203392
203546
|
exports.getWorkerDeviceRegistry = require_manifest_python_deps.getWorkerDeviceRegistry;
|
|
203393
203547
|
exports.hasDotNode = hasDotNode;
|
|
203394
203548
|
exports.hashClusterSecret = hashClusterSecret;
|
|
203549
|
+
exports.hubMainRssBudget = require_manifest_python_deps.hubMainRssBudget;
|
|
203395
203550
|
exports.installManifestNativeDeps = require_manifest_python_deps.installManifestNativeDeps;
|
|
203396
203551
|
exports.installManifestPythonDeps = require_manifest_python_deps.installManifestPythonDeps;
|
|
203397
203552
|
exports.installPackageFromNpm = installPackageFromNpm;
|
|
@@ -203420,8 +203575,10 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
|
|
|
203420
203575
|
exports.localEndpointPath = require_manifest_python_deps.localEndpointPath;
|
|
203421
203576
|
exports.localProviderLink = require_manifest_python_deps.localProviderLink;
|
|
203422
203577
|
exports.mountNativeCapService = require_manifest_python_deps.mountNativeCapService;
|
|
203578
|
+
exports.nextRssBudgetState = require_manifest_python_deps.nextRssBudgetState;
|
|
203423
203579
|
exports.parseCapAction = require_manifest_python_deps.parseCapAction;
|
|
203424
203580
|
exports.parseRangeHeader = require_file_data_plane.parseRangeHeader;
|
|
203581
|
+
exports.parseRssBudgetMb = require_manifest_python_deps.parseRssBudgetMb;
|
|
203425
203582
|
exports.parseTokenizedUrl = require_file_data_plane.parseTokenizedUrl;
|
|
203426
203583
|
exports.partitionIsolatedBuiltinIds = partitionIsolatedBuiltinIds;
|
|
203427
203584
|
exports.proxyToUpstream = proxyToUpstream;
|
|
@@ -417610,7 +417767,7 @@ var require_main4 = __commonJS({
|
|
|
417610
417767
|
async function bootstrap() {
|
|
417611
417768
|
const heapReclaimer = (0, system_1.createV8Reclaimer)();
|
|
417612
417769
|
const heapReclaim = heapReclaimer === void 0 ? void 0 : { reclaim: heapReclaimer };
|
|
417613
|
-
(0, system_1.startHeapWatch)("hub-main", void 0, void 0, heapReclaim);
|
|
417770
|
+
(0, system_1.startHeapWatch)("hub-main", void 0, void 0, heapReclaim, void 0, void 0, true, (0, system_1.hubMainRssBudget)());
|
|
417614
417771
|
cleanupOrphanProcesses();
|
|
417615
417772
|
let spaIndexHtml = null;
|
|
417616
417773
|
const configPath = process.env.CONFIG_PATH ?? path.join(process.env.CAMSTACK_DATA ?? path.join(process.cwd(), "camstack-data"), "config.yaml");
|