Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

leosvelperez
Copy link
Member

@leosvelperez leosvelperez commented Oct 21, 2025

Current Behavior

In some scenarios, when some processes terminate unexpectedly (e.g. crashed due to OOM), the task runner will incorrectly determine their exit code to be 0. This results in Nx storing the task results as a success, which can cause cache hits with false positive successes.

Expected Behavior

When processes terminate unexpectedly (e.g. crashed due to OOM), the task runner should correctly determine their exit code from the signal, and it should never be 0. The stored task result should not be marked as successful.

Related Issue(s)

Fixes #29204

@leosvelperez leosvelperez self-assigned this Oct 21, 2025
@vercel
Copy link

vercel bot commented Oct 21, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
nx-dev Ready Ready Preview Oct 22, 2025 7:14am

@netlify
Copy link

netlify bot commented Oct 21, 2025

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit 1184968
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/68f881726d01bd0008ae4e12
😎 Deploy Preview https://deploy-preview-33163--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud
Copy link
Contributor

nx-cloud bot commented Oct 21, 2025

View your CI Pipeline Execution ↗ for commit 1184968

Command Status Duration Result
nx affected --targets=lint,test,test-kt,build,e... ✅ Succeeded 40m 26s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 2m 46s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 3s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 3s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗
nx affected -t e2e-macos-local --parallel=1 --b... ✅ Succeeded 39m 55s View ↗

☁️ Nx Cloud last updated this comment at 2025-10-22 07:55:39 UTC

Copy link
Contributor

@nx-cloud nx-cloud bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nx Cloud is proposing a fix for your failed CI:

We've updated the signalToCode function signature to accept NodeJS.Signals | null instead of just NodeJS.Signals, which resolves the TypeScript compilation error. When the signal is null, the function now returns exit code 1 as a sensible default for crashed processes.

We verified this fix by re-running create-nx-workspace:test.

Suggested Fix changes
diff --git a/packages/create-nx-workspace/src/utils/child-process-utils.ts b/packages/create-nx-workspace/src/utils/child-process-utils.ts
index 9fa3e6cab5..8a508352fb 100644
--- a/packages/create-nx-workspace/src/utils/child-process-utils.ts
+++ b/packages/create-nx-workspace/src/utils/child-process-utils.ts
@@ -60,7 +60,10 @@ export function execAndWait(
   });
 }
 
-function signalToCode(signal: NodeJS.Signals): number {
+function signalToCode(signal: NodeJS.Signals | null): number {
+  if (signal === null) {
+    return 1;
+  }
   switch (signal) {
     case 'SIGHUP':
       return 128 + 1;
diff --git a/packages/nx/src/utils/exit-codes.ts b/packages/nx/src/utils/exit-codes.ts
index 309ab8aafc..0f23124ae4 100644
--- a/packages/nx/src/utils/exit-codes.ts
+++ b/packages/nx/src/utils/exit-codes.ts
@@ -2,7 +2,10 @@
  * Translates NodeJS signals to numeric exit code
  * @param signal
  */
-export function signalToCode(signal: NodeJS.Signals): number {
+export function signalToCode(signal: NodeJS.Signals | null): number {
+  if (signal === null) {
+    return 1;
+  }
   switch (signal) {
     case 'SIGHUP':
       return 128 + 1;

Apply fix via Nx Cloud  Reject fix via Nx Cloud

Or Apply changes locally with:

npx nx-cloud apply-locally 4Ns9-rr3U

Apply fix locally with your editor ↗  View interactive diff ↗


🎓 To learn more about Self Healing CI, please visit nx.dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

task if crashed by OOM is marked as successful and then cached

4 participants