fix(mesh): name the teapot in the boot log a later 404 points back to
A route the absent teapot would have exported 404s, and that is the right status: nothing was ever registered for a manifest that never arrived, so there is no path to serve. But a bare 404 is indistinguishable from a typo in the path, and the boot log is the only place the two are told apart. It could not tell them apart either. The give-up warning relied on the error's own message to identify the teapot, which holds for a refusal -- `mesh handshake failed: <url>` -- but not for an unreachable one, where the error is a socket error that may carry no url at all. So the url is passed in now, and every line of the boot-connect story names it: the retries, the refusal, and the give-up. The give-up line also says no manifest was ever exchanged, which is the fact that explains the 404. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
2 files changed
+44
-7
No files matched your search
+9
-7
@@ -775,6 +775,7 @@ async function connectUntilDeadline(
|
||||
mesh: MeshConfig,
|
||||
bus: Bus,
|
||||
logger: Logger,
|
||||
url: string,
|
||||
attempt: () => Promise<Link>,
|
||||
): Promise<Link | undefined> {
|
||||
const budgetMs = mesh.bootTimeoutMs ?? mesh.timeoutMs ?? 30_000;
|
||||
@@ -793,7 +794,7 @@ async function connectUntilDeadline(
|
||||
// thirty seconds. Retrying a wrong secret only spends the deploy's patience to reach the
|
||||
// identical error, so it fails now.
|
||||
if (isPermanentRefusal(error)) {
|
||||
logger.error(`mesh: the teapot refused this peer, which retrying cannot fix — ${(error as Error).message}`);
|
||||
logger.error(`mesh: teapot ${url} refused this peer, which retrying cannot fix — ${(error as Error).message}`);
|
||||
throw error;
|
||||
}
|
||||
|
||||
@@ -804,17 +805,18 @@ async function connectUntilDeadline(
|
||||
// at all — its routes 404 and a local `needs` on its tokens still fails in finalize().
|
||||
if (remaining <= 0) {
|
||||
logger.warn(
|
||||
`mesh: teapot unreachable after ${attempts} attempt(s) over ${budgetMs}ms ` +
|
||||
`(${(error as Error).message}) — starting without it. It sent no manifest, so none of ` +
|
||||
`its steps or routes are in this graph: its routes 404, and the boot still fails if ` +
|
||||
`anything local needs one of its tokens.`,
|
||||
`mesh: teapot ${url} unreachable after ${attempts} attempt(s) over ${budgetMs}ms ` +
|
||||
`(${(error as Error).message}) — starting without it. No manifest was ever exchanged, ` +
|
||||
`so none of its steps or routes are in this graph: its routes 404 like any path that ` +
|
||||
`was never registered, and the boot still fails if anything local needs one of its ` +
|
||||
`tokens. This line is what a later 404 on one of its routes points back to.`,
|
||||
);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
bus.emit('mesh:boot:retry', { name: `attempt ${attempts}`, error });
|
||||
logger.warn(
|
||||
`mesh: teapot unreachable (${(error as Error).message}) — retrying, ${remaining}ms of boot budget left`,
|
||||
`mesh: teapot ${url} unreachable (${(error as Error).message}) — retrying, ${remaining}ms of boot budget left`,
|
||||
);
|
||||
await new Promise((resolve) => setTimeout(resolve, Math.min(delay, Math.max(0, remaining))));
|
||||
delay = Math.min(delay * 2, 5_000);
|
||||
@@ -857,7 +859,7 @@ async function spliceRemoteScopes(
|
||||
try {
|
||||
for (const teapot of mesh.teapots ?? []) {
|
||||
warnIfCleartext(teapot.url, logger);
|
||||
const link = await connectUntilDeadline(mesh, bus, logger, () =>
|
||||
const link = await connectUntilDeadline(mesh, bus, logger, teapot.url, () =>
|
||||
connectLink({
|
||||
url: teapot.url,
|
||||
secret: teapot.secret,
|
||||
|
||||
Reference in new issue
Block a user