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 Daemon Server crashing when running pnpm install #23031

Closed
4 tasks
lukeramsden opened this issue Apr 26, 2024 · 5 comments · Fixed by #23500
Closed
4 tasks

NX Daemon Server crashing when running pnpm install #23031

lukeramsden opened this issue Apr 26, 2024 · 5 comments · Fixed by #23500
Assignees
Labels

Comments

@lukeramsden
Copy link

lukeramsden commented Apr 26, 2024

Current Behavior

Subsequent to #21492, we upgraded to 18.3.4 which contains the fix, and removed our hacky workaround where we call nx reset after running pnpm install due to the daemon server panicing in the Rust code.

We now see a different error:

[NX Daemon Server] - 2024-04-26T11:14:25.496Z - [WATCHER]: Unexpected workspace error Cannot read properties of null (reading 'message')
TypeError: Cannot read properties of null (reading 'message')
    at handleWorkspaceChanges (/<redacted>/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_/node_modules/nx/src/daemon/server/server.js:203:90)
    at /<redacted>/ui/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_/node_modules/nx/src/daemon/server/watcher.js:36:9

Expected Behavior

We would expect the daemon not to crash when running pnpm install

GitHub Repo

No response

Steps to Reproduce

  1. npx nx reset && npx nx daemon --start # start a clean daemon
  2. pnpm install # run install on an unchanged package.json and subsequently unchanged pnpm-lock.yaml
  3. Check daemon logs for the crash

Nx Report

NX  Falling back to ts-node for local typescript execution. This may be a little slower.
  - To fix this, ensure @swc-node/register and @swc/core have been installed

 NX   Report complete - copy this into the issue template

Node   : 20.11.1
OS     : linux-x64
pnpm   : 9.0.2

nx                 : 18.3.4
@nx/js             : 18.3.4
@nx/jest           : 18.3.4
@nx/linter         : 18.3.4
@nx/eslint         : 18.3.4
@nx/workspace      : 18.3.4
@nx/cypress        : 18.3.4
@nx/devkit         : 18.3.4
@nx/esbuild        : 18.3.4
@nx/eslint-plugin  : 18.3.4
@nx/node           : 18.3.4
@nx/react          : 18.3.4
@nx/rollup         : 18.3.4
@nx/storybook      : 18.3.4
@nrwl/tao          : 18.3.4
@nx/web            : 18.3.4
@nx/webpack        : 18.3.4
typescript         : 5.1.6

Failure Logs

No response

Package Manager Version

pnpm 9.0.2

Operating System

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

Additional Information

No response

@AgentEnder AgentEnder added the scope: core core nx functionality label Apr 29, 2024
@creotip
Copy link

creotip commented Apr 30, 2024

Downgrade pnpm to v8, it will solve the issue

corepack use pnpm@latest-8

@lukeramsden
Copy link
Author

Still see this on 19.0.3

[NX Daemon Server] - 2024-05-16T09:06:45.162Z - [WATCHER]: 2 file(s) created or restored, 5 file(s) modified, 0 file(s) deleted
[NX Daemon Server] - 2024-05-16T09:06:45.216Z - [WATCHER]: Unexpected workspace error Cannot read properties of null (reading 'message')
TypeError: Cannot read properties of null (reading 'message')
    at handleWorkspaceChanges (<redacted>/ui/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_/node_modules/nx/src/daemon/server/server.js:203:90)
    at <redacted>/ui/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_/node_modules/nx/src/daemon/server/watcher.js:36:9
[NX Daemon Server] - 2024-05-16T09:06:45.295Z - [REQUEST]: Updated workspace context based on watched changes, recomputing project graph...
[NX Daemon Server] - 2024-05-16T09:06:45.295Z - [REQUEST]: build/log/npx-console.log,build/log/profile_packageMonorepo.json,packages/protocols/fixplorer-protocol-types/src/lib/generated/index.ts,packages/protocols/trader-desktop-public-protocol-types/src/lib/generated/index.ts,packages/protocols/hds-public-protocol-types/src/lib/generated/index.ts,packages/protocols/websocket-session-public-protocol-types/src/lib/generated/index.ts,packages/protocols/feedback-protocol-types/src/lib/generated/index.ts
[NX Daemon Server] - 2024-05-16T09:06:45.296Z - [REQUEST]: 
[NX Daemon Server] - 2024-05-16T09:06:45.495Z - [WATCHER]: Processing file changes in outputs
[NX Daemon Server] - 2024-05-16T09:06:45.499Z - Time taken for 'Load Nx Plugin: <redacted>/ui/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_/node_modules/nx/src/plugins/project-json/build-nodes/package-json-next-to-project-json' 0.678927999921143ms
[NX Daemon Server] - 2024-05-16T09:07:44.456Z - Established a connection. Number of open connections: 1
[NX Daemon Server] - 2024-05-16T09:07:44.460Z - Closed a connection. Number of open connections: 0
[NX Daemon Server] - 2024-05-16T09:07:44.466Z - Established a connection. Number of open connections: 1
[NX Daemon Server] - 2024-05-16T09:07:44.466Z - [REQUEST]: Responding to the client with an error. File watcher error in the workspace '<redacted>/ui'. Cannot read properties of null (reading 'message')
TypeError: Cannot read properties of null (reading 'message')
    at handleWorkspaceChanges (<redacted>/ui/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_/node_modules/nx/src/daemon/server/server.js:203:90)
    at <redacted>/ui/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_/node_modules/nx/src/daemon/server/watcher.js:36:9
[NX Daemon Server] - 2024-05-16T09:07:44.467Z - Done responding to the client null
[NX Daemon Server] - 2024-05-16T09:07:44.474Z - [REQUEST]: Client Request for Project Graph Received
[NX Daemon Server] - 2024-05-16T09:07:44.476Z - [REQUEST]: Responding to the client. project-graph
[NX Daemon Server] - 2024-05-16T09:07:44.481Z - Time taken for 'total for creating and serializing project graph' 2.1216579996980727ms
[NX Daemon Server] - 2024-05-16T09:07:44.489Z - Socket error
Error: read ECONNRESET
    at Pipe.onStreamRead (node:internal/stream_base_commons:217:20) {
  errno: -104,
  code: 'ECONNRESET',
  syscall: 'read'
}
[NX Daemon Server] - 2024-05-16T09:07:44.492Z - Done responding to the client project-graph
[NX Daemon Server] - 2024-05-16T09:07:44.492Z - Handled REQUEST_PROJECT_GRAPH. Handling time: 2. Response time: 16.
[NX Daemon Server] - 2024-05-16T09:07:44.499Z - Closed a connection. Number of open connections: 0
[NX Daemon Server] - 2024-05-16T09:07:44.599Z - [WATCHER]: Processing file changes in outputs
[NX Daemon Server] - 2024-05-16T09:07:44.611Z - [WATCHER]: Skipping handleWorkspaceChanges because of a previously recorded watcher error.
[NX Daemon Server] - 2024-05-16T09:08:53.586Z - [WATCHER]: Skipping handleWorkspaceChanges because of a previously recorded watcher error.
[NX Daemon Server] - 2024-05-16T09:08:53.586Z - [WATCHER]: Processing file changes in outputs
[NX Daemon Server] - 2024-05-16T09:09:18.825Z - [WATCHER]: Skipping handleWorkspaceChanges because of a previously recorded watcher error.
[NX Daemon Server] - 2024-05-16T09:09:18.826Z - [WATCHER]: Processing file changes in outputs
[NX Daemon Server] - 2024-05-16T09:09:22.555Z - [WATCHER]: Skipping handleWorkspaceChanges because of a previously recorded watcher error.
[NX Daemon Server] - 2024-05-16T09:09:22.555Z - [WATCHER]: Processing file changes in outputs
[NX Daemon Server] - 2024-05-16T09:09:23.184Z - Established a connection. Number of open connections: 1
[NX Daemon Server] - 2024-05-16T09:09:23.186Z - Closed a connection. Number of open connections: 0
[NX Daemon Server] - 2024-05-16T09:09:23.187Z - Established a connection. Number of open connections: 1
[NX Daemon Server] - 2024-05-16T09:09:23.189Z - [REQUEST]: Responding to the client with an error. File watcher error in the workspace '<redacted>/ui'. Cannot read properties of null (reading 'message')
TypeError: Cannot read properties of null (reading 'message')
    at handleWorkspaceChanges (<redacted>/ui/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_/node_modules/nx/src/daemon/server/server.js:203:90)
    at <redacted>/ui/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_/node_modules/nx/src/daemon/server/watcher.js:36:9
[NX Daemon Server] - 2024-05-16T09:09:23.189Z - Done responding to the client null
[NX Daemon Server] - 2024-05-16T09:09:23.190Z - [REQUEST]: Client Request for Project Graph Received
[NX Daemon Server] - 2024-05-16T09:09:23.191Z - [REQUEST]: Responding to the client. project-graph
[NX Daemon Server] - 2024-05-16T09:09:23.193Z - Time taken for 'total for creating and serializing project graph' 0.9973229998722672ms
[NX Daemon Server] - 2024-05-16T09:09:23.197Z - Socket error
Error: read ECONNRESET
    at Pipe.onStreamRead (node:internal/stream_base_commons:217:20) {
  errno: -104,
  code: 'ECONNRESET',
  syscall: 'read'
}
[NX Daemon Server] - 2024-05-16T09:09:23.197Z - Done responding to the client project-graph
[NX Daemon Server] - 2024-05-16T09:09:23.197Z - Handled REQUEST_PROJECT_GRAPH. Handling time: 1. Response time: 6.
[NX Daemon Server] - 2024-05-16T09:09:23.197Z - Closed a connection. Number of open connections: 0
[NX Daemon Server] - 2024-05-16T09:09:23.259Z - [WATCHER]: Skipping handleWorkspaceChanges because of a previously recorded watcher error.
[NX Daemon Server] - 2024-05-16T09:09:23.259Z - [WATCHER]: Processing file changes in outputs
[NX Daemon Server] - 2024-05-16T09:12:40.325Z - [WATCHER]: Skipping handleWorkspaceChanges because of a previously recorded watcher error.
[NX Daemon Server] - 2024-05-16T09:12:40.325Z - [WATCHER]: Processing file changes in outputs
[NX Daemon Server] - 2024-05-16T09:13:07.416Z - [WATCHER]: Processing file changes in outputs
[NX Daemon Server] - 2024-05-16T09:13:07.426Z - [WATCHER]: Skipping handleWorkspaceChanges because of a previously recorded watcher error.
[NX Daemon Server] - 2024-05-16T09:13:10.900Z - [WATCHER]: Skipping handleWorkspaceChanges because of a previously recorded watcher error.
[NX Daemon Server] - 2024-05-16T09:13:10.900Z - [WATCHER]: Processing file changes in outputs
[NX Daemon Server] - 2024-05-16T09:13:11.661Z - Established a connection. Number of open connections: 1
[NX Daemon Server] - 2024-05-16T09:13:11.664Z - Closed a connection. Number of open connections: 0
[NX Daemon Server] - 2024-05-16T09:13:11.666Z - Established a connection. Number of open connections: 1
[NX Daemon Server] - 2024-05-16T09:13:11.668Z - [REQUEST]: Responding to the client with an error. File watcher error in the workspace '<redacted>/ui'. Cannot read properties of null (reading 'message')
TypeError: Cannot read properties of null (reading 'message')
    at handleWorkspaceChanges (<redacted>/ui/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_/node_modules/nx/src/daemon/server/server.js:203:90)
    at <redacted>/ui/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_/node_modules/nx/src/daemon/server/watcher.js:36:9
[NX Daemon Server] - 2024-05-16T09:13:11.669Z - Done responding to the client null
[NX Daemon Server] - 2024-05-16T09:13:11.669Z - [REQUEST]: Client Request for Project Graph Received
[NX Daemon Server] - 2024-05-16T09:13:11.670Z - [REQUEST]: Responding to the client. project-graph
[NX Daemon Server] - 2024-05-16T09:13:11.678Z - Time taken for 'total for creating and serializing project graph' 1.195639000274241ms
[NX Daemon Server] - 2024-05-16T09:13:11.680Z - Socket error
Error: read ECONNRESET
    at Pipe.onStreamRead (node:internal/stream_base_commons:217:20) {
  errno: -104,
  code: 'ECONNRESET',
  syscall: 'read'
}
[NX Daemon Server] - 2024-05-16T09:13:11.681Z - Done responding to the client project-graph
[NX Daemon Server] - 2024-05-16T09:13:11.681Z - Handled REQUEST_PROJECT_GRAPH. Handling time: 1. Response time: 11.
[NX Daemon Server] - 2024-05-16T09:13:11.681Z - Closed a connection. Number of open connections: 0

Cammisuli added a commit that referenced this issue May 17, 2024
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
<!-- This is the behavior we have today -->
When there are watch event changes, and we filter them all out, we get
an empty `changedEvents` array. There were previous checks that had a
`!changedEvents.length` condition that resolved to true when the length
was 0.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
We now check to see if `err` is set before triggering the error branch

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #23031
FrozenPandaz pushed a commit that referenced this issue May 21, 2024
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
<!-- This is the behavior we have today -->
When there are watch event changes, and we filter them all out, we get
an empty `changedEvents` array. There were previous checks that had a
`!changedEvents.length` condition that resolved to true when the length
was 0.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
We now check to see if `err` is set before triggering the error branch

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #23031

(cherry picked from commit 3bbc964)
Copy link

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 Jun 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@creotip @Cammisuli @AgentEnder @lukeramsden and others