Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions daemon/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ if (SANDBOX_MODE) {
);
}

// Surface scheduled-restart configuration so it's easy to rule out as the cause
// of "the daemon keeps restarting" reports.
console.log(
`[daemon] ${UNSTABLE_WORKER_RESPAWN_INTERVAL_MS_ENV_NAME}=${
UNSTABLE_WORKER_RESPAWN_INTERVAL_MS ?? "unset"
}`,
);

globalThis.addEventListener(
"unhandledrejection",
(e: { promise: Promise<unknown>; reason: unknown }) => {
Expand Down
4 changes: 4 additions & 0 deletions daemon/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ export const watchMeta = async (signal?: AbortSignal) => {

dispatchWorkerState("updating");
console.error(error);
// Backoff to avoid a tight retry spin when the worker fetch fails fast
// (e.g. connection refused mid-restart); without this, the loop pegs CPU
// and floods stderr until a supervisor kills the daemon.
await new Promise((resolve) => setTimeout(resolve, 1000));
}
}

Expand Down
4 changes: 3 additions & 1 deletion daemon/workers/denoRun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ export class DenoRun implements Isolate {
},
});
}
const hostname = Deno.build.os === "windows" ? "localhost" : "0.0.0.0";
// 127.0.0.1 is the correct loopback for outbound connections;
// 0.0.0.0 is a bind wildcard and not a valid connect target on macOS/Linux.
const hostname = Deno.build.os === "windows" ? "localhost" : "127.0.0.1";
this.proxyUrl = `http://${hostname}:${this.port}`;
this.client = typeof Deno.createHttpClient === "function"
? Deno.createHttpClient({
Expand Down
Loading