Skip to content

Commit e2d3aa9

Browse files
fix(tailscale): escalate hung serve commands to SIGKILL (pingdotgg#28529)
Co-authored-by: maria-rcks <[email protected]>
1 parent 6a61904 commit e2d3aa9

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

‎packages/tailscale/src/tailscale.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,8 @@ describe("tailscale", () => {
338338
return Effect.gen(function* () {
339339
yield* readTailscaleStatus.pipe(Effect.provide(layer));
340340
yield* readTailscaleSshEnabled.pipe(Effect.provide(layer));
341-
assert.deepEqual(killGraces, [500, 500]);
341+
yield* ensureTailscaleServe({ localPort: 45_678 }).pipe(Effect.provide(layer));
342+
assert.deepEqual(killGraces, [500, 500, 500]);
342343
});
343344
});
344345
});

‎packages/tailscale/src/tailscale.ts‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -397,12 +397,14 @@ const runTailscaleCommand = Effect.fn("tailscale.runTailscaleCommand")(function*
397397
};
398398
const timeout = Duration.fromInputUnsafe(timeoutInput);
399399
return yield* Effect.gen(function* () {
400-
const child = yield* spawner.spawn(ChildProcess.make(executable, args)).pipe(
401-
Effect.mapError((cause) => new TailscaleCommandSpawnError({ ...commandContext, cause })),
402-
Effect.catchDefect((cause) =>
403-
Effect.fail(new TailscaleCommandSpawnError({ ...commandContext, cause })),
404-
),
405-
);
400+
const child = yield* spawner
401+
.spawn(ChildProcess.make(executable, args, { forceKillAfter: TAILSCALE_KILL_GRACE }))
402+
.pipe(
403+
Effect.mapError((cause) => new TailscaleCommandSpawnError({ ...commandContext, cause })),
404+
Effect.catchDefect((cause) =>
405+
Effect.fail(new TailscaleCommandSpawnError({ ...commandContext, cause })),
406+
),
407+
);
406408
const [stderr, exitCode] = yield* Effect.all(
407409
[collectStderr(child.stderr), child.exitCode.pipe(Effect.map(Number))],
408410
{ concurrency: "unbounded" },

0 commit comments

Comments
 (0)