nrwl / nx

Smart Monorepos ยท Fast CI
https://nx.dev
MIT License
23.51k stars 2.34k forks source link

nx daemon errors when using concurrently #17342

Open robertIsaac opened 1 year ago

robertIsaac commented 1 year ago

Current Behavior

when launching two nx jobs using concurrently to work in parallel, it throw the following error for all of them Server stopped because: "this process is no longer the current daemon"

Expected Behavior

for it to work fine

GitHub Repo

https://github.com/robertIsaac/daemon-process-terminated-reprod

Steps to Reproduce

  1. clone the project
  2. run npm ci
  3. run npx nx reset
  4. run npm run ci

or just create any new project, install concurrently, and make it run any two nx jobs like concurrently npm:build npm:test

Nx Report

Node   : 18.16.0
   OS     : win32 x64
   npm    : 9.6.7
   Hasher : Native

   nx                 : 16.3.0
   @nx/js             : 16.3.0
   @nx/jest           : 16.3.0
   @nx/linter         : 16.3.0
   @nx/workspace      : 16.3.0
   @nx/angular        : 16.3.0
   @nx/cypress        : 16.3.0
   @nx/devkit         : 16.3.0
   @nx/eslint-plugin  : 16.3.0
   @nrwl/tao          : 16.3.0
   @nx/web            : 16.3.0
   @nx/webpack        : 16.3.0
   typescript         : 5.0.4

Failure Logs

run ci

> @daemon-process-terminated-reprod/source@0.0.0 ci
> concurrently npm:test npm:lint npm:build

[test] 
[test] > @daemon-process-terminated-reprod/source@0.0.0 test
[test] > nx affected --target=test --coverage --parallel=false
[test] 
[build] 
[build] > @daemon-process-terminated-reprod/source@0.0.0 build
[build] > nx build
[build] 
[lint] 
[lint] > @daemon-process-terminated-reprod/source@0.0.0 lint
[lint] > nx affected --target=lint --quiet
[lint] 
[lint] 
[test] 
[lint]  >  NX   Affected criteria defaulted to --base=master --head=HEAD
[test]  >  NX   Affected criteria defaulted to --base=master --head=HEAD
[test]
[lint]
[build] 
[build]  >  NX   Error: write EPIPE
[build]
[build]
[build]    Messages from the log:
[build]    [NX Daemon Server] - 2023-05-31T21:20:04.852Z - [REQUEST]: Updated file-hasher based on watched changes, recomputing project graph...
[build]    [NX Daemon Server] - 2023-05-31T21:20:04.852Z - [REQUEST]:
[build]    [NX Daemon Server] - 2023-05-31T21:20:04.852Z - [REQUEST]:
[build]    [NX Daemon Server] - 2023-05-31T21:20:04.877Z - [REQUEST]: Responding to the client. project-graph
[build]    [NX Daemon Server] - 2023-05-31T21:20:04.878Z - [REQUEST]: Client Request for Project Graph Received
[build]    [NX Daemon Server] - 2023-05-31T21:20:04.879Z - [REQUEST]: Responding to the client. project-graph
[build]    [NX Daemon Server] - 2023-05-31T21:20:04.880Z - [REQUEST]: Client Request for Project Graph Received
[build]    [NX Daemon Server] - 2023-05-31T21:20:04.880Z - [REQUEST]: Responding to the client. project-graph
[build]    [NX Daemon Server] - 2023-05-31T21:20:04.881Z - Time taken for 'total for creating and serializing project graph' 110.0463000535965ms
[build]    [NX Daemon Server] - 2023-05-31T21:20:04.882Z - Done responding to the client project-graph
[build]    [NX Daemon Server] - 2023-05-31T21:20:04.882Z - Handled REQUEST_PROJECT_GRAPH. Handling time: 110. Response time: 5.
[build]    [NX Daemon Server] - 2023-05-31T21:20:04.882Z - Done responding to the client project-graph
[build]    [NX Daemon Server] - 2023-05-31T21:20:04.882Z - Handled REQUEST_PROJECT_GRAPH. Handling time: 1. Response time: 3.
[build]    [NX Daemon Server] - 2023-05-31T21:20:04.882Z - Done responding to the client project-graph
[build]    [NX Daemon Server] - 2023-05-31T21:20:04.882Z - Handled REQUEST_PROJECT_GRAPH. Handling time: 0. Response time: 2.
[build]    [NX Daemon Server] - 2023-05-31T21:20:04.882Z - [WATCHER]: Unsubscribed from changes within: C:\Users\rober\WebstormProjects\daemon-process-terminated-reprod (sources)
[build]    [NX Daemon Server] - 2023-05-31T21:20:04.883Z - [WATCHER]: Unsubscribed from changes within: C:\Users\rober\WebstormProjects\daemon-process-terminated-reprod (outputs)
[build]    [NX Daemon Server] - 2023-05-31T21:20:04.883Z - [WATCHER]: Unsubscribed from changes within: C:\Users\rober\WebstormProjects\daemon-process-terminated-reprod (server-process.json)
[build]    [NX Daemon Server] - 2023-05-31T21:20:04.883Z - Server stopped because: "this process is no longer the current daemon"
[build]
[build]
[build]
[build]    More information: C:\Users\rober\WebstormProjects\daemon-process-terminated-reprod\node_modules\.cache\nx\d\daemon.log
[build]    Pass --verbose to see the stacktrace.
[build]
[test] nx affected
[test]
[test] Run target for affected projects
[test]
[test] Run command using --base=[SHA1] (affected by the committed, uncommitted and untracked changes):
[test]       --base  Base of the current branch (usually main)  [string]
[test]
[test] or using --base=[SHA1] --head=[SHA2] (affected by the committed changes):
[test]       --base  Base of the current branch (usually main)  [string]
[test]       --head  Latest commit of the current branch (usually HEAD)  [string]
[test]
[test] or using:
[test]       --files        Change the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas or spaces  [string]
[test]       --uncommitted  Uncommitted changes  [boolean]
[test]       --untracked    Untracked changes  [boolean]
[test]
[test] Options:
[test]       --help               Show help  [boolean]
[test]       --version            Show version number  [boolean]
[test]   -c, --configuration      This is the configuration to use when performing tasks on projects  [string]
[test]   -t, --targets, --target  Tasks to run for affected projects  [string] [required]
[test]       --output-style       Defines how Nx emits outputs tasks logs  [string] [choices: "dynamic", "static", "stream", "stream-without-prefixes"]
[test]       --exclude            Exclude certain projects from being processed  [string]
[test]       --parallel           Max number of parallel processes [default is 3]  [string]
[test]       --runner             This is the name of the tasks runner configured in nx.json  [string]
[test]       --graph              Show the task graph of the command. Pass a file path to save the graph data instead of viewing it in the browser.  [string] [default: false]
[test]       --verbose            Prints additional information about the commands (e.g., stack traces)  [boolean]
[test]       --nx-bail            Stop command execution after the first failed task  [boolean] [default: false]
[test]       --nx-ignore-cycles   Ignore cycles in the task graph  [boolean] [default: false]
[test]       --skip-nx-cache      Rerun the tasks even when the results are available in the cache  [boolean] [default: false]
[test]       --all  [deprecated: Use `nx run-many` instead] [boolean]
[test]
[test] Examples:
[test]   affected -t custom-target                               Run custom target for all affected projects
[test]   affected -t test --parallel=5                           Run tests in parallel
[test]   affected -t test --all                                  Run the test target for all projects
[test]   affected -t lint test build                             Run lint, test, and build targets for affected projects. Requires Nx v15.4+
[test]   affected -t test --files=libs/mylib/src/index.ts        Run tests for all the projects affected by changing the index.ts file
[test]   affected -t test --base=main --head=HEAD                Run tests for all the projects affected by the changes between main and HEAD (e.g., PR)
[test]   affected -t test --base=main~1 --head=main              Run tests for all the projects affected by the last commit on main
[test]   affected -t build --exclude '*,!tag:dotnet'             Run build for only projects with the tag `dotnet`
[test]   affected -t build --tag=$NX_TASK_TARGET_PROJECT:latest  Use the currently executing project name in your command.
[test]
[test] Find more information and examples at https://nx.dev/nx/affected
[lint] nx affected
[lint]
[lint] Run target for affected projects
[lint]
[lint] Run command using --base=[SHA1] (affected by the committed, uncommitted and untracked changes):
[lint]       --base  Base of the current branch (usually main)  [string]
[lint]
[lint] or using --base=[SHA1] --head=[SHA2] (affected by the committed changes):
[lint]       --base  Base of the current branch (usually main)  [string]
[lint]       --head  Latest commit of the current branch (usually HEAD)  [string]
[lint]
[lint] or using:
[lint]       --files        Change the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas or spaces  [string]
[lint]       --uncommitted  Uncommitted changes  [boolean]
[lint]       --untracked    Untracked changes  [boolean]
[lint]
[lint] Options:
[lint]       --help               Show help  [boolean]
[lint]       --version            Show version number  [boolean]
[lint]   -c, --configuration      This is the configuration to use when performing tasks on projects  [string]
[lint]   -t, --targets, --target  Tasks to run for affected projects  [string] [required]
[lint]       --output-style       Defines how Nx emits outputs tasks logs  [string] [choices: "dynamic", "static", "stream", "stream-without-prefixes"]
[lint]       --exclude            Exclude certain projects from being processed  [string]
[lint]       --parallel           Max number of parallel processes [default is 3]  [string]
[lint]       --runner             This is the name of the tasks runner configured in nx.json  [string]
[lint]       --graph              Show the task graph of the command. Pass a file path to save the graph data instead of viewing it in the browser.  [string] [default: false]
[lint]       --verbose            Prints additional information about the commands (e.g., stack traces)  [boolean]
[lint]       --nx-bail            Stop command execution after the first failed task  [boolean] [default: false]
[lint]       --nx-ignore-cycles   Ignore cycles in the task graph  [boolean] [default: false]
[lint]       --skip-nx-cache      Rerun the tasks even when the results are available in the cache  [boolean] [default: false]
[lint]       --all  [deprecated: Use `nx run-many` instead] [boolean]
[lint]
[lint] Examples:
[lint]   affected -t custom-target                               Run custom target for all affected projects
[lint]   affected -t test --parallel=5                           Run tests in parallel
[lint]   affected -t test --all                                  Run the test target for all projects
[lint]   affected -t lint test build                             Run lint, test, and build targets for affected projects. Requires Nx v15.4+
[lint]   affected -t test --files=libs/mylib/src/index.ts        Run tests for all the projects affected by changing the index.ts file
[lint]   affected -t test --base=main --head=HEAD                Run tests for all the projects affected by the changes between main and HEAD (e.g., PR)
[lint]   affected -t test --base=main~1 --head=main              Run tests for all the projects affected by the last commit on main
[lint]   affected -t build --exclude '*,!tag:dotnet'             Run build for only projects with the tag `dotnet`
[lint]   affected -t build --tag=$NX_TASK_TARGET_PROJECT:latest  Use the currently executing project name in your command.
[lint]
[lint] Find more information and examples at https://nx.dev/nx/affected
[lint]
[test]
[test] Error: Error: write EPIPE
[test]
[test] Messages from the log:
[test] [NX Daemon Server] - 2023-05-31T21:20:04.852Z - [REQUEST]: Updated file-hasher based on watched changes, recomputing project graph...
[test] [NX Daemon Server] - 2023-05-31T21:20:04.852Z - [REQUEST]:
[test] [NX Daemon Server] - 2023-05-31T21:20:04.852Z - [REQUEST]:
[test] [NX Daemon Server] - 2023-05-31T21:20:04.877Z - [REQUEST]: Responding to the client. project-graph
[test] [NX Daemon Server] - 2023-05-31T21:20:04.878Z - [REQUEST]: Client Request for Project Graph Received
[test] [NX Daemon Server] - 2023-05-31T21:20:04.879Z - [REQUEST]: Responding to the client. project-graph
[test] [NX Daemon Server] - 2023-05-31T21:20:04.880Z - [REQUEST]: Client Request for Project Graph Received
[test] [NX Daemon Server] - 2023-05-31T21:20:04.880Z - [REQUEST]: Responding to the client. project-graph
[test] [NX Daemon Server] - 2023-05-31T21:20:04.881Z - Time taken for 'total for creating and serializing project graph' 110.0463000535965ms
[test] [NX Daemon Server] - 2023-05-31T21:20:04.882Z - Done responding to the client project-graph
[test] [NX Daemon Server] - 2023-05-31T21:20:04.882Z - Handled REQUEST_PROJECT_GRAPH. Handling time: 110. Response time: 5.
[test] [NX Daemon Server] - 2023-05-31T21:20:04.882Z - Done responding to the client project-graph
[test] [NX Daemon Server] - 2023-05-31T21:20:04.882Z - Handled REQUEST_PROJECT_GRAPH. Handling time: 1. Response time: 3.
[test] [NX Daemon Server] - 2023-05-31T21:20:04.882Z - Done responding to the client project-graph
[test] [NX Daemon Server] - 2023-05-31T21:20:04.882Z - Handled REQUEST_PROJECT_GRAPH. Handling time: 0. Response time: 2.
[test] [NX Daemon Server] - 2023-05-31T21:20:04.882Z - [WATCHER]: Unsubscribed from changes within: C:\Users\rober\WebstormProjects\daemon-process-terminated-reprod (sources)
[test] [NX Daemon Server] - 2023-05-31T21:20:04.883Z - [WATCHER]: Unsubscribed from changes within: C:\Users\rober\WebstormProjects\daemon-process-terminated-reprod (outputs)
[test] [NX Daemon Server] - 2023-05-31T21:20:04.883Z - [WATCHER]: Unsubscribed from changes within: C:\Users\rober\WebstormProjects\daemon-process-terminated-reprod (server-process.json)
[test] [NX Daemon Server] - 2023-05-31T21:20:04.883Z - Server stopped because: "this process is no longer the current daemon"
[test]
[test]
[test]
[test] More information: C:\Users\rober\WebstormProjects\daemon-process-terminated-reprod\node_modules\.cache\nx\d\daemon.log
[test]     at daemonProcessException (C:\Users\rober\WebstormProjects\daemon-process-terminated-reprod\node_modules\nx\src\daemon\client\client.js:334:23)
[test]     at Socket.<anonymous> (C:\Users\rober\WebstormProjects\daemon-process-terminated-reprod\node_modules\nx\src\daemon\client\client.js:205:25)
[test]     at Socket.emit (node:events:513:28)
[test]     at emitErrorNT (node:internal/streams/destroy:151:8)
[test]     at emitErrorCloseNT (node:internal/streams/destroy:116:3)
[test]     at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
[test]   internalDaemonError: true
[test] }
[lint] Error: Error: write EPIPE
[lint]
[lint] Messages from the log:
[lint] [NX Daemon Server] - 2023-05-31T21:20:04.852Z - [REQUEST]: Updated file-hasher based on watched changes, recomputing project graph...
[lint] [NX Daemon Server] - 2023-05-31T21:20:04.852Z - [REQUEST]:
[lint] [NX Daemon Server] - 2023-05-31T21:20:04.852Z - [REQUEST]:
[lint] [NX Daemon Server] - 2023-05-31T21:20:04.877Z - [REQUEST]: Responding to the client. project-graph
[lint] [NX Daemon Server] - 2023-05-31T21:20:04.878Z - [REQUEST]: Client Request for Project Graph Received
[lint] [NX Daemon Server] - 2023-05-31T21:20:04.879Z - [REQUEST]: Responding to the client. project-graph
[lint] [NX Daemon Server] - 2023-05-31T21:20:04.880Z - [REQUEST]: Client Request for Project Graph Received
[lint] [NX Daemon Server] - 2023-05-31T21:20:04.880Z - [REQUEST]: Responding to the client. project-graph
[lint] [NX Daemon Server] - 2023-05-31T21:20:04.881Z - Time taken for 'total for creating and serializing project graph' 110.0463000535965ms
[lint] [NX Daemon Server] - 2023-05-31T21:20:04.882Z - Done responding to the client project-graph
[lint] [NX Daemon Server] - 2023-05-31T21:20:04.882Z - Handled REQUEST_PROJECT_GRAPH. Handling time: 110. Response time: 5.
[lint] [NX Daemon Server] - 2023-05-31T21:20:04.882Z - Done responding to the client project-graph
[lint] [NX Daemon Server] - 2023-05-31T21:20:04.882Z - Handled REQUEST_PROJECT_GRAPH. Handling time: 1. Response time: 3.
[lint] [NX Daemon Server] - 2023-05-31T21:20:04.882Z - Done responding to the client project-graph
[lint] [NX Daemon Server] - 2023-05-31T21:20:04.882Z - Handled REQUEST_PROJECT_GRAPH. Handling time: 0. Response time: 2.
[lint] [NX Daemon Server] - 2023-05-31T21:20:04.882Z - [WATCHER]: Unsubscribed from changes within: C:\Users\rober\WebstormProjects\daemon-process-terminated-reprod (sources)
[lint] [NX Daemon Server] - 2023-05-31T21:20:04.883Z - [WATCHER]: Unsubscribed from changes within: C:\Users\rober\WebstormProjects\daemon-process-terminated-reprod (outputs)
[lint] [NX Daemon Server] - 2023-05-31T21:20:04.883Z - [WATCHER]: Unsubscribed from changes within: C:\Users\rober\WebstormProjects\daemon-process-terminated-reprod (server-process.json)
[lint] [NX Daemon Server] - 2023-05-31T21:20:04.883Z - Server stopped because: "this process is no longer the current daemon"
[lint]
[lint]
[lint]
[lint] More information: C:\Users\rober\WebstormProjects\daemon-process-terminated-reprod\node_modules\.cache\nx\d\daemon.log
[lint]     at daemonProcessException (C:\Users\rober\WebstormProjects\daemon-process-terminated-reprod\node_modules\nx\src\daemon\client\client.js:334:23)
[lint]     at Socket.<anonymous> (C:\Users\rober\WebstormProjects\daemon-process-terminated-reprod\node_modules\nx\src\daemon\client\client.js:205:25)
[lint]     at Socket.emit (node:events:513:28)
[lint]     at emitErrorNT (node:internal/streams/destroy:151:8)
[lint]     at emitErrorCloseNT (node:internal/streams/destroy:116:3)
[lint]     at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
[lint]   internalDaemonError: true
[lint] }
[build] npm run build exited with code 1
[lint] npm run lint exited with code 1
[test] npm run test exited with code 1

Process finished with exit code 1

Operating System

Additional Information

  1. in the real application, I'm trying to run multiple tasks in watch mode, so they don't exit and concurrently is the only option, but to keep the reprod small, I mocked it with different types of jobs
  2. if I ran single job e.g. nx lint then npm run ci it will work, but if then tried to run nx reset it will fail saying it's in use, I think one or more of the three process actually doesn't terminate, this can cause memory leaks
FabienDehopre commented 1 year ago

I have the same issue since last night. Commands fail randomly on windows. I attached the daemon.log. daemon.log

rconjoe commented 1 year ago

We ran a migration from 16.5.4 to 16.8.1, then ran a task executor that clears the local caches manually, runs nx reset, then runs new builds using concurrency and remote caching.

At least half of the machines that ran the migration had this issue. We fixed by simply restarting the daemon explicitly with nx daemon --start and --stop.

github-actions[bot] commented 7 months ago

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! ๐Ÿ™

robertIsaac commented 7 months ago

Any updates?

AdarshJais commented 7 months ago

Is this resolved or does nx have its way of achieving what concurrently packages provide?

robertIsaac commented 7 months ago

Is this resolved or does nx have its way of achieving what concurrently packages provide?

Neither And even some things that was working before, stopped working now Like nx run-many serve it stopped working in nx 18.0

kasir-barati commented 6 months ago

IDK if this is also the same thing but I've landed here after I bound my host dir (my monorepo) into the docker and ran nx serve backend inside the container (CMD ["nx", "serve", "backend", "--skip-nx-cache"]) and after that I executed nx sleep backend-e2e in my terminal (notice that it is happening outside of docker and in my bash terminal).

OS: Linux, Nx version: 18.0.7

apps/backend-e2e/project.json

// ...
"sleep": {
  "command": "sleep 20"
}
// ...

My intention was to just see if it is behaving the same way no matter what is the command.

apps/backend/project.json

// ...
"serve": {
  "executor": "@nx/js:node",
  "defaultConfiguration": "development",
  "options": {
    "buildTarget": "backend:build"
  },
  "configurations": {
    "development": {
      "buildTarget": "backend:build:development"
    },
    "production": {
      "buildTarget": "backend:build:production"
    }
  }
},
// ...

It is pretty much the normal stuff. Any idea on exactly why is this happening?

daemon.log

[NX Daemon Server] - 2024-03-31T08:52:38.929Z - Started listening on: /tmp/f53b52ad6d21cceb72df/d.sock
[NX Daemon Server] - 2024-03-31T08:52:38.933Z - [WATCHER]: Subscribed to changes within: /app (native)
[NX Daemon Server] - 2024-03-31T08:52:38.938Z - Established a connection. Number of open connections: 1
[NX Daemon Server] - 2024-03-31T08:52:38.942Z - Established a connection. Number of open connections: 2
[NX Daemon Server] - 2024-03-31T08:52:38.947Z - Closed a connection. Number of open connections: 1
[NX Daemon Server] - 2024-03-31T08:52:38.950Z - [REQUEST]: Client Request for Project Graph Received
[NX Daemon Server] - 2024-03-31T08:52:38.952Z - [REQUEST]: Updated workspace context based on watched changes, recomputing project graph...
[NX Daemon Server] - 2024-03-31T08:52:38.952Z - [REQUEST]: 
[NX Daemon Server] - 2024-03-31T08:52:38.952Z - [REQUEST]: 
[NX Daemon Server] - 2024-03-31T08:52:38.977Z - [WATCHER]: .nx/cache/d/server-process.json was modified
[NX Daemon Server] - 2024-03-31T08:52:38.981Z - [WATCHER]: Stopping the watcher for /home/kasir/projects/you-say (sources)
[NX Daemon Server] - 2024-03-31T08:52:38.987Z - [WATCHER]: Stopping the watcher for /home/kasir/projects/you-say (outputs)
[NX Daemon Server] - 2024-03-31T08:52:38.987Z - Server stopped because: "this process is no longer the current daemon (native)"
[NX Daemon Server] - 2024-03-31T08:52:40.303Z - [REQUEST]: Responding to the client. project-graph
[NX Daemon Server] - 2024-03-31T08:52:40.305Z - Time taken for 'total for creating and serializing project graph' 1353.3187549998984ms
[NX Daemon Server] - 2024-03-31T08:52:40.320Z - Done responding to the client project-graph
[NX Daemon Server] - 2024-03-31T08:52:40.321Z - Handled REQUEST_PROJECT_GRAPH. Handling time: 1353. Response time: 18.
[NX Daemon Server] - 2024-03-31T08:52:40.337Z - Established a connection. Number of open connections: 2
[NX Daemon Server] - 2024-03-31T08:52:42.287Z - [WATCHER]: Processing file changes in outputs
[NX Daemon Server] - 2024-03-31T08:52:43.817Z - [WATCHER]: Processing file changes in outputs
[NX Daemon Server] - 2024-03-31T08:52:43.870Z - [WATCHER]: Processing file changes in outputs
[NX Daemon Server] - 2024-03-31T08:52:43.924Z - [WATCHER]: Processing file changes in outputs
[NX Daemon Server] - 2024-03-31T08:52:45.824Z - [WATCHER]: Processing file changes in outputs
[NX Daemon Server] - 2024-03-31T08:52:50.754Z - [WATCHER]: Processing file changes in outputs
[NX Daemon Server] - 2024-03-31T08:53:17.051Z - Started listening on: /tmp/06cbc0145e488774ca70/d.sock
[NX Daemon Server] - 2024-03-31T08:53:17.055Z - [WATCHER]: Subscribed to changes within: /home/kasir/projects/you-say (native)
[NX Daemon Server] - 2024-03-31T08:53:17.063Z - Established a connection. Number of open connections: 1
[NX Daemon Server] - 2024-03-31T08:53:17.065Z - Established a connection. Number of open connections: 2
[NX Daemon Server] - 2024-03-31T08:53:17.068Z - Closed a connection. Number of open connections: 1
[NX Daemon Server] - 2024-03-31T08:53:17.070Z - [REQUEST]: Client Request for Project Graph Received
[NX Daemon Server] - 2024-03-31T08:53:17.071Z - [REQUEST]: Updated workspace context based on watched changes, recomputing project graph...
[NX Daemon Server] - 2024-03-31T08:53:17.072Z - [REQUEST]: 
[NX Daemon Server] - 2024-03-31T08:53:17.072Z - [REQUEST]: 
[NX Daemon Server] - 2024-03-31T08:53:17.100Z - [WATCHER]: .nx/cache/d/server-process.json was modified
[NX Daemon Server] - 2024-03-31T08:53:17.102Z - Time taken for 'changed-projects' 0.9088389999233186ms
[NX Daemon Server] - 2024-03-31T08:53:17.102Z - [WATCHER]: Stopping the watcher for /app (sources)
[NX Daemon Server] - 2024-03-31T08:53:17.108Z - [WATCHER]: Stopping the watcher for /app (outputs)
[NX Daemon Server] - 2024-03-31T08:53:17.108Z - Server stopped because: "this process is no longer the current daemon (native)"
[NX Daemon Server] - 2024-03-31T08:53:18.317Z - [REQUEST]: Responding to the client. project-graph
[NX Daemon Server] - 2024-03-31T08:53:18.318Z - Time taken for 'total for creating and serializing project graph' 1246.9035809999332ms
[NX Daemon Server] - 2024-03-31T08:53:18.320Z - Done responding to the client project-graph
[NX Daemon Server] - 2024-03-31T08:53:18.320Z - Handled REQUEST_PROJECT_GRAPH. Handling time: 1247. Response time: 3.
[NX Daemon Server] - 2024-03-31T08:53:18.389Z - [REQUEST]: Responding to the client. handleHashTasks
[NX Daemon Server] - 2024-03-31T08:53:18.390Z - Done responding to the client handleHashTasks
[NX Daemon Server] - 2024-03-31T08:53:18.390Z - Handled HASH_TASKS. Handling time: 26. Response time: 1.
[NX Daemon Server] - 2024-03-31T08:53:38.669Z - [REQUEST]: Responding to the client. recordOutputsHash
[NX Daemon Server] - 2024-03-31T08:53:38.669Z - Done responding to the client recordOutputsHash
[NX Daemon Server] - 2024-03-31T08:53:38.669Z - Handled RECORD_OUTPUTS_HASH. Handling time: 0. Response time: 1.
[NX Daemon Server] - 2024-03-31T08:53:38.680Z - Closed a connection. Number of open connections: 0

And here is what I mean by binding my host dir into docker container:

dev.Dockerfile

FROM docker.io/node:20.10.0-alpine
USER 1000:1000
WORKDIR /app
RUN chown -R 1000:1000 /app

EXPOSE 3001

CMD ["npx" ,"nx", "serve", "backend", "--skip-nx-cache"]

docker-compose.yml:

version: "3"

services:
# ...
  backend:
    image: backend-image:dev
    container_name: backend-container
    build:
      context: .
      dockerfile: ./apps/backend/dev.Dockerfile
    volumes:
      - type: bind
        source: .
        target: /app
        volume:
          nocopy: true
# ...
MaxKless commented 5 months ago

Hey! Thanks for the report and especially thank you for the reproduction. I could repro with it. However, I tried again on the latest version of Nx on both MacOS & Windows and could run multiple npm scripts that use nx affected with concurrently without problem. So I think the issue is fixed on the latest version.

If it still happens for you, please let me know with another repro and I'll have a look :)

robertIsaac commented 5 months ago

hi @MaxKless it still happens with me I have updated the reprod repo to latest nx (19.0) and it still happens

> @daemon-process-terminated-reprod/source@0.0.0 ci
> concurrently npm:test npm:lint npm:build

[lint] 
[lint] > @daemon-process-terminated-reprod/source@0.0.0 lint
[lint] > nx affected --target=lint --quiet
[lint] 
[build] 
[build] > @daemon-process-terminated-reprod/source@0.0.0 build
[build] > nx build
[build] 
[test] 
[test] > @daemon-process-terminated-reprod/source@0.0.0 test
[test] > nx affected --target=test --coverage --parallel=false
[test] 
[test] 
[build] 
[build]  NX   Missing Platform Dependency
[build] 
[build] The Nx CLI could not find or load the native binary for your supported platform (win32-x64).
[build] This likely means that optional dependencies were not installed correctly, or your system is missing some system dependencies.
[build] For more information please see https://nx.dev/troubleshooting/troubleshoot-nx-install-issues
[build]
[test]  NX   Missing Platform Dependency
[test]
[test] The Nx CLI could not find or load the native binary for your supported platform (win32-x64).
[test] This likely means that optional dependencies were not installed correctly, or your system is missing some system dependencies.
[test] For more information please see https://nx.dev/troubleshooting/troubleshoot-nx-install-issues
[test]
[test] npm run test exited with code 1
[lint] 
[lint]  NX   Affected criteria defaulted to --base=master --head=HEAD
[lint]
[build] npm run build exited with code 1
[lint] 
[lint]  NX   No projects with target lint for 0 projects were run
[lint]
[lint]
[lint]
[lint]
[lint]  NX   Successfully ran target lint for 0 projects
[lint]
[lint]
[lint] npm run lint exited with code 0

Process finished with exit code 1

you can see that lint succeeded because it was the first task, build and test failed

MaxKless commented 5 months ago

Hmmm interesting, it's throwing a completely different error now. Did you go through the troubleshooting steps linked in the error message?

robertIsaac commented 5 months ago

Hmmm interesting, it's throwing a completely different error now. Did you go through the troubleshooting steps linked in the error message?

It's not a totally different error, it's just different error No I didn't check the link since I know the root cause Re running the command will yield positive result

The root cause still that nx daemon doesn't work with concurrent

MaxKless commented 5 months ago

ok can you update the repro above with the latest versions so I can see the same error you're seeing?

robertIsaac commented 5 months ago

ok can you update the repro above with the latest versions so I can see the same error you're seeing?

It's updated now to v19

github-actions[bot] commented 4 months ago

This issue has been automatically marked as stale because no results of retrying on the latest version of Nx was provided within 7 days. It will be closed in 21 days if no results are provided. If the issue is still present, please reply to keep it active. If the issue was not present, please close this issue. Thanks for being a part of the Nx community! ๐Ÿ™

robertIsaac commented 4 months ago

Hi @MaxKless can you please remove the tag retry with latest since it's already done