Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nx does not support parallel tasks in devcontainer #22574

Closed
1 of 4 tasks
JacobLey opened this issue Mar 29, 2024 · 3 comments
Closed
1 of 4 tasks

Nx does not support parallel tasks in devcontainer #22574

JacobLey opened this issue Mar 29, 2024 · 3 comments
Assignees
Labels

Comments

@JacobLey
Copy link
Contributor

JacobLey commented Mar 29, 2024

Current Behavior

Open a code repo in a devcontainer.

Define 3 tasks. They can do literally nothing (nx:noop)

  • task A
  • task B
  • task C
    • depends on A + B

Attempt to execute task C: nx run example:c.

Nx fails to run task B, but provides no extra info even in --verbose mode

Expected Behavior

All 3 tasks should execute correctly, in the order defined by the dependency graph.

Since the tasks themselves do literally nothing, it should not be possible for this command to fail.

GitHub Repo

https://github.com/JacobLey/issue-recreator/tree/nx-parallel-devcontainer

Steps to Reproduce

(Copied from README of github repo)

  1. Open this package in a DevContainer.
  • This code was personally tested in VSCode.
  1. Run npm i to install Nx
  • A "global" version was already installed during DevContainer spin up
  1. Run nx run example:c --verbose

The terminal looks like the following:

$ nx run example:c --verbose

 NX   Running target c for project example and 2 tasks it depends on:

—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

> nx run example:a


> nx run example:b


—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 NX   Running target c for project example and 2 tasks it depends on failed

Failed tasks:

- example:b

Hint: run the command with --verbose for more details.

Inspecting the nx.json file, every task is a simple nx:noop executor.
The selected task C depends on both A + B. A is successful, but B fails.

No extra information is outputted with the failure.

Nx Report

NX   Report complete - copy this into the issue template

Node   : 20.11.1
OS     : linux-arm64
npm    : 10.2.4

nx (global)  : 18.1.3
nx           : 18.1.3
@nrwl/tao    : 18.1.3

Failure Logs

Error: Operation not permitted (os error 1)

at PseudoTerminal.fork (/workspace/node_modules/nx/src/tasks-runner/pseudo-terminal.js:42:73)

at ForkedProcessTaskRunner.forkProcessWithPseudoTerminal (/workspace/node_modules/nx/src/tasks-runner/forked-process-task-runner.js:141:45)


at ForkedProcessTaskRunner.forkProcess (/workspace/node_modules/nx/src/tasks-runner/forked-process-task-runner.js:127:25)

at TaskOrchestrator.runTaskInForkedProcess (/workspace/node_modules/nx/src/tasks-runner/task-orchestrator.js:260:54)
                                             at TaskOrchestrator.applyFromCacheOrRunTask (/workspace/node_modules/nx/src/tasks-runner/task-orchestrator.js:243:61)

at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
                                                                                          at async TaskOrchestrator.executeNextBatchOfTasksUsingTaskSchedule (/workspace/node_modules/nx/src/tasks-runner/task-orchestrator.js:76:13)

at async Promise.all (index 1)
                                            at async TaskOrchestrator.run (/workspace/node_modules/nx/src/tasks-runner/task-orchestrator.js:53:9)

at async defaultTasksRunner (/workspace/node_modules/nx/src/tasks-runner/default-tasks-runner.js:18:16) {
 code: 'GenericFailure'
}

Package Manager Version

npm - 10.2.4

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

Issue appears specific to devcontainer. I am not able to reproduce when using local terminal.

Devcontainer is based on debian, so while I am on a mac, this may be caused by some linux incompatability.

The error is swallowed here: https://github.com/nrwl/nx/blob/master/packages/nx/src/tasks-runner/task-orchestrator.ts#L495

Editing the line of code locally to print the failure message provided above.

The forking happens on a native binding, which is why the stack trace does not go farther.

It appears that more than one fork at a time is not supported.

@FrozenPandaz FrozenPandaz added the scope: core core nx functionality label Apr 2, 2024
@maxtomczyk
Copy link

maxtomczyk commented Jun 14, 2024

I encountered the same issue in my project. Also managed to find the Error: Operation not permitted (os error 1). Setting NX_NATIVE_COMMAND_RUNNER environment variable to false helps, but it's not real solution. Is there any progress in fixing this issue?

Some more context on my env:

Node   : 20.13.1
OS     : linux-x64
pnpm   : 9.1.1

nx (global)        : 19.2.3
nx                 : 19.2.3
@nx/js             : 19.2.3
@nx/jest           : 19.2.3
@nx/linter         : 19.2.3
@nx/eslint         : 19.2.3
@nx/workspace      : 19.2.3
@nx/devkit         : 19.2.3
@nx/eslint-plugin  : 19.2.3
@nx/plugin         : 19.2.3
@nrwl/tao          : 19.2.3
@nx/vite           : 19.2.3
@nx/vue            : 19.2.3
@nx/web            : 19.2.3
typescript         : 5.4.5
---------------------------------------
Registered Plugins:
nx/plugins/package-json
@rpl/nx-vue
---------------------------------------
Local workspace plugins:
         @rpl/nx-nuxt
         @rpl/nx-vue

@JacobLey
Copy link
Contributor Author

JacobLey commented Aug 2, 2024

I am no longer able to replicate with 19.5!

I believe the Stackblitz support that updated the internal rust binaries has addressed this

Closing this issue, although the related issue about forked process failures being hidden from user is probably still relevant.

I can't tell you how many times I had to deal with "flaky target detected" issues when it was just Nx failing to detect it's own crashes

@JacobLey JacobLey closed this as completed Aug 2, 2024
Copy link

github-actions bot commented Sep 2, 2024

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants