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

ConnectionManager can now be destroyed safely #866

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

allada
Copy link
Collaborator

@allada allada commented Apr 19, 2024

Reduces chance of any issues related to ConnectionManager not being destroyed safely due to un-terminated spawns.


This change is Reviewable

Copy link
Collaborator Author

@allada allada left a comment

Choose a reason for hiding this comment

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

cc: @chrisstaite-menlo , @zbirenbaum

+@adam-singer

Reviewable status: 0 of 1 LGTMs obtained, and pending CI: Analyze (javascript-typescript), Analyze (python), Bazel Dev / ubuntu-22.04, Cargo Dev / macos-13, Cargo Dev / ubuntu-22.04, Local / ubuntu-22.04, Publish image, Publish nativelink-worker-lre-cc, Remote / large-ubuntu-22.04, asan / ubuntu-22.04, docker-compose-compiles-nativelink (20.04), docker-compose-compiles-nativelink (22.04), integration-tests (20.04), integration-tests (22.04), macos-13, pre-commit-checks, ubuntu-20.04 / stable, ubuntu-22.04, ubuntu-22.04 / stable, vale, windows-2022 / stable, zig-cc ubuntu-20.04, zig-cc ubuntu-22.04 (waiting on @adam-singer)

Reduces chance of any issues related to ConnectionManager
not being destroyed safely due to un-terminated spawns.
@allada allada force-pushed the ensure-connection-manager-has-safe-shutdown branch from 502e952 to 7319ba7 Compare April 19, 2024 04:04
Copy link
Contributor

@adam-singer adam-singer left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: 1 of 1 LGTMs obtained, and pending CI: Remote / large-ubuntu-22.04

@chrisstaite
Copy link
Contributor

I don't think this is the best solution. I think waiting for EOF on both RX in the worker makes more sense. The ownership of the worker is by itself and making the ConnectionManager block on Drop seems an unnecessary hack.

@chrisstaite
Copy link
Contributor

nativelink-util/src/connection_manager.rs line 225 at r1 (raw file):

                        // The ConnectionManager was dropped, shut down the
                        // worker.
                        break;

We should add a loop here waiting for connection_rx to return None and then we'll be done. None of the other changes are necessary.

Copy link
Collaborator Author

@allada allada left a comment

Choose a reason for hiding this comment

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

This solution did not work as I expected anyway...

The long vision is to be able to have Nativelink be able to be given a new config at runtime, and it'd construct an entirely different set of stores/schedulers/exc... (or recycle them) and then start dispatching work to the new services on request receives without needing to restart Nativelink.

In other words, change configs without any down time.

To do this we need to ensure all our structs can be destroyed safely. I'll look deeper, but in reality, I'd prefer if there was a way to confirm that a component and all allocated resources are freed, but it's tricky due to rust's way of dealing with Drop in a synchronous way.

Reviewable status: 1 of 1 LGTMs obtained, and 1 discussions need to be resolved

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.

None yet

3 participants