Skip to content

Commit ad5fb5f

Browse files
committed
prevent task monitor from processing errors handled elsewhere
1 parent 75d292b commit ad5fb5f

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

apps/kubernetes-provider/src/taskMonitor.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export class TaskMonitor {
140140
const containerState = this.#getContainerStateSummary(containerStatus.state);
141141
const exitCode = containerState.exitCode ?? -1;
142142

143-
if (exitCode === EXIT_CODE_ALREADY_HANDLED) {
143+
if (exitCode === EXIT_CODE_ALREADY_HANDLED || exitCode === EXIT_CODE_CHILD_NONZERO) {
144144
this.#logger.debug("Ignoring pod failure, already handled by worker", {
145145
podName,
146146
});
@@ -186,9 +186,8 @@ export class TaskMonitor {
186186
break;
187187
case "OOMKilled":
188188
overrideCompletion = true;
189-
reason = `${
190-
exitCode === EXIT_CODE_CHILD_NONZERO ? "Child process" : "Parent process"
191-
} ran out of memory! Try choosing a machine preset with more memory for this task.`;
189+
reason =
190+
"[TaskMonitor] Your task ran out of memory. Try increasing the machine specs. If this doesn't fix it there might be a memory leak.";
192191
errorCode = TaskRunErrorCodes.TASK_PROCESS_OOM_KILLED;
193192
break;
194193
default:

packages/cli-v3/src/entryPoints/deploy-run-controller.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -519,12 +519,12 @@ class ProdWorker {
519519

520520
logger.log("completion acknowledged", { willCheckpointAndRestore, shouldExit });
521521

522-
const exitCode =
522+
const isNonZeroExitError =
523523
!completion.ok &&
524524
completion.error.type === "INTERNAL_ERROR" &&
525-
completion.error.code === TaskRunErrorCodes.TASK_PROCESS_EXITED_WITH_NON_ZERO_CODE
526-
? EXIT_CODE_CHILD_NONZERO
527-
: 0;
525+
completion.error.code === TaskRunErrorCodes.TASK_PROCESS_EXITED_WITH_NON_ZERO_CODE;
526+
527+
const exitCode = isNonZeroExitError ? EXIT_CODE_CHILD_NONZERO : 0;
528528

529529
if (shouldExit) {
530530
// Exit after completion, without any retrying

packages/core/src/v3/apps/process.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
/** This was used by the old build system in case of indexing failures */
12
export const EXIT_CODE_ALREADY_HANDLED = 111;
2-
export const EXIT_CODE_CHILD_NONZERO = 112;
3+
/** This means what it says and is only set once we have completed the attempt */
4+
export const EXIT_CODE_CHILD_NONZERO = 112;

0 commit comments

Comments
 (0)