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

fix(core): connections to daemon from plugin workers should not keep daemon alive #29540

Closed

Conversation

AgentEnder
Copy link
Member

Current Behavior

The daemon uses ref counts to shut down automatically when it is not being actively used. Plugin workers are started by the daemon and shut down automatically when the daemon shuts down. If one of these plugins communicates with the daemon, a reference is counted. This plugin worker will not shut down until the daemon shuts down, so its socket will not be closed... so the daemon will stay alive.

Expected Behavior

Connections to the daemon from a plugin worker do not track a reference. More generally, connections from any source can unref themselves.

Related Issue(s)

Fixes #

@AgentEnder AgentEnder requested a review from a team as a code owner January 7, 2025 15:37
@AgentEnder AgentEnder requested a review from Cammisuli January 7, 2025 15:37
Copy link

vercel bot commented Jan 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Jan 7, 2025 3:37pm

Copy link

nx-cloud bot commented Jan 7, 2025

View your CI Pipeline Execution ↗ for commit ec939fb.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 3m 20s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 20s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 1s View ↗
nx-cloud record -- nx format:check --base=cb4a9... ✅ Succeeded 1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗
nx documentation --no-dte ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2025-01-09 18:03:40 UTC

@@ -122,6 +123,8 @@ export class DaemonClient {
private _out: FileHandle = null;
private _err: FileHandle = null;

private firstMessageSent = false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is unused.

@@ -153,7 +158,9 @@ const server = createServer(async (socket) => {
});

socket.on('close', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I thought this only gets called when the client is destroyed?

The client won't be destroyed in the plugin worker right? Does this actually do anything at the moment?

@AgentEnder
Copy link
Member Author

Closing in favor of new strategy recommended by @FrozenPandaz

@AgentEnder AgentEnder closed this Jan 14, 2025
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

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

Successfully merging this pull request may close these issues.

2 participants