@andersbakken/fisk 5.0.7 → 5.0.9

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.
@@ -55207,7 +55207,7 @@ class VM extends EventEmitter__default["default"] {
55207
55207
  }
55208
55208
 
55209
55209
  const Version = 5;
55210
- const ObjectCacheFormatVersion = 2;
55210
+ const ObjectCacheFormatVersion = 3;
55211
55211
  function cacheDir(option) {
55212
55212
  let dir = option("cache-dir");
55213
55213
  if (!dir) {
@@ -60984,6 +60984,8 @@ server.on("job", (job) => {
60984
60984
  success: event.success,
60985
60985
  exitCode: event.exitCode,
60986
60986
  sha1: jobJob.sha1,
60987
+ sourcePath: path__default["default"].join(j.op.vmDir, "sourcefile"),
60988
+ originalSourcePath: jobJob.sourcePath,
60987
60989
  stderr: j.stderr,
60988
60990
  stdout: j.stdout
60989
60991
  };
@@ -61008,7 +61010,6 @@ server.on("job", (job) => {
61008
61010
  uncompressedSize: item.uncompressed.byteLength
61009
61011
  };
61010
61012
  }) });
61011
- cacheResponse.sourcePath = jobJob.sourcePath;
61012
61013
  cacheResponse.commandLine = jobJob.commandLine;
61013
61014
  cacheResponse.environment = jobJob.hash;
61014
61015
  objectCache.add(cacheResponse, contents);
@@ -3762,7 +3762,7 @@ class Slots extends EventEmitter__default["default"] {
3762
3762
  }
3763
3763
 
3764
3764
  const Version = 5;
3765
- const ObjectCacheFormatVersion = 2;
3765
+ const ObjectCacheFormatVersion = 3;
3766
3766
  function cacheDir(option) {
3767
3767
  let dir = option("cache-dir");
3768
3768
  if (!dir) {
@@ -4511,7 +4511,7 @@ const option = createOptions({
4511
4511
  const common = common$1(option);
4512
4512
  const debug = option("debug");
4513
4513
  process.on("unhandledRejection", (reason, p) => {
4514
- console.log("Unhandled Rejection at: Promise", p, "reason:", reason === null || reason === void 0 ? void 0 : reason.stack);
4514
+ console.error("Unhandled Rejection at: Promise", p, "reason:", reason === null || reason === void 0 ? void 0 : reason.stack);
4515
4515
  process.exit();
4516
4516
  // if (client)
4517
4517
  // client.send('log', { message: `Unhandled Rejection at: Promise ${p}, reason: ${reason.stack}` });
@@ -4535,6 +4535,7 @@ const compileSlots = new Slots(option.int("slots", Math.max(os__default["default
4535
4535
  const localSlotCount = option.int("local-slots", 0);
4536
4536
  const localSlots = new Slots(localSlotCount, "local", debug);
4537
4537
  const localSlotsMaxLoad = option("local-slots-max-load") || 0;
4538
+ console.log(`cpp slots: ${cppSlots.capacity}, compile slots: ${compileSlots.capacity}, local slots: ${localSlots.capacity}, local max load: ${localSlotsMaxLoad}`);
4538
4539
  const compilerInfoCache = new CompilerInfoCache();
4539
4540
  const slotSubscribers = [];
4540
4541
  function slotsInfo() {
@@ -4659,9 +4660,7 @@ server.on("compile", (compile) => {
4659
4660
  }
4660
4661
  });
4661
4662
  compile.on("acquireSlot", (msg) => {
4662
- if (debug) {
4663
- console.log("acquireSlot", msg);
4664
- }
4663
+ console.log("acquireSlot", msg);
4665
4664
  const compilerPath = msg && typeof msg.compiler === "string" && msg.compiler.length > 0 ? msg.compiler : null;
4666
4665
  const infoResult = compilerPath
4667
4666
  ? compilerInfoCache.get(compilerPath).then((info) => ({ info, error: null }), (err) => {
@@ -4688,7 +4687,7 @@ server.on("compile", (compile) => {
4688
4687
  }
4689
4688
  compile.send(response);
4690
4689
  };
4691
- if (canAcquireLocalSlot() && localSlots.tryAcquire(compile.id, { pid: compile.pid })) {
4690
+ if (!(msg === null || msg === void 0 ? void 0 : msg["no-local"]) && canAcquireLocalSlot() && localSlots.tryAcquire(compile.id, { pid: compile.pid })) {
4692
4691
  if (debug) {
4693
4692
  console.log("acquireSlot -> local slot granted");
4694
4693
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andersbakken/fisk",
3
- "version": "5.0.7",
3
+ "version": "5.0.9",
4
4
  "description": "Fisk, a distributed compile system",
5
5
  "scripts": {
6
6
  "lint": "eslint . --ext .ts",
@@ -56418,7 +56418,7 @@ class Server extends require$$0__default$2["default"] {
56418
56418
  }
56419
56419
 
56420
56420
  const Version = 5;
56421
- const ObjectCacheFormatVersion = 2;
56421
+ const ObjectCacheFormatVersion = 3;
56422
56422
  function cacheDir(option) {
56423
56423
  let dir = option("cache-dir");
56424
56424
  if (!dir) {
@@ -57979,6 +57979,9 @@ Options:
57979
57979
  --max-file-descriptors=N File descriptor limit
57980
57980
  --ping-interval=MS WebSocket ping interval
57981
57981
  --monitor-log=PATH Log file for monitor events
57982
+ --event-loop-lag-interval=MS Event loop lag sample interval (0 disables)
57983
+ --event-loop-lag-threshold=MS Log a stall at or above this lag
57984
+ --event-loop-lag-summary-interval=MS Lag summary interval (0 disables)
57982
57985
  --env-dir=PATH Directory for compiler environments
57983
57986
  --ui=PATH Path to scheduler UI static files
57984
57987
  --cache-dir=PATH Cache directory (default: ~/.cache/fisk/scheduler)
@@ -57997,6 +58000,41 @@ let nextCommandId = 0;
57997
58000
  const server = new Server(option, common.Version);
57998
58001
  const clientMinimumVersion = "5.0.6";
57999
58002
  const serverStartTime = Date.now();
58003
+ // A stalled event loop stops calling accept(), the listen backlog fills and the
58004
+ // kernel then silently drops SYNs, which clients see as a connect timeout rather
58005
+ // than a refusal. It leaves no trace by the time anyone runs ss(8), so record it
58006
+ // here with timestamps that can be correlated against client-side timeouts.
58007
+ const intervalMs = option.int("event-loop-lag-interval", 100);
58008
+ const thresholdMs = option.int("event-loop-lag-threshold", 250);
58009
+ const summaryIntervalMs = option.int("event-loop-lag-summary-interval", 60000);
58010
+ if (intervalMs > 0) {
58011
+ let maxLag = 0;
58012
+ let stalls = 0;
58013
+ let expected = Date.now() + intervalMs;
58014
+ const tick = () => {
58015
+ const now = Date.now();
58016
+ const lag = now - expected;
58017
+ if (lag > maxLag) {
58018
+ maxLag = lag;
58019
+ }
58020
+ if (lag >= thresholdMs) {
58021
+ ++stalls;
58022
+ console.log(`event-loop-lag stall ${lag}ms at ${new Date(now).toISOString()}`);
58023
+ }
58024
+ // Schedule off "now" rather than accumulating on expected, otherwise a
58025
+ // single long stall reports as a stall on every subsequent tick.
58026
+ expected = now + intervalMs;
58027
+ setTimeout(tick, intervalMs).unref();
58028
+ };
58029
+ setTimeout(tick, intervalMs).unref();
58030
+ if (summaryIntervalMs > 0) {
58031
+ setInterval(() => {
58032
+ console.log(`event-loop-lag summary max=${maxLag}ms stalls=${stalls} over last ${summaryIntervalMs}ms (threshold ${thresholdMs}ms)`);
58033
+ maxLag = 0;
58034
+ stalls = 0;
58035
+ }, summaryIntervalMs).unref();
58036
+ }
58037
+ }
58000
58038
  process.on("unhandledRejection", (reason, p) => {
58001
58039
  console.error("Unhandled Rejection at: Promise", p, "reason:", reason === null || reason === void 0 ? void 0 : reason.stack);
58002
58040
  addLogFile({ source: "no source file", ip: "self", contents: `reason: ${reason.stack} promise` });