-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
router: track endpoints more explicitly #19554
Merged
allisonkarlitskaya
merged 3 commits into
cockpit-project:main
from
allisonkarlitskaya:endpoint-close
Nov 10, 2023
Merged
router: track endpoints more explicitly #19554
allisonkarlitskaya
merged 3 commits into
cockpit-project:main
from
allisonkarlitskaya:endpoint-close
Nov 10, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
allisonkarlitskaya
temporarily deployed
to
gh-cockpituous
November 2, 2023 12:37
— with
GitHub Actions
Inactive
allisonkarlitskaya
force-pushed
the
endpoint-close
branch
from
November 2, 2023 12:38
a6c354c
to
203f70e
Compare
allisonkarlitskaya
temporarily deployed
to
gh-cockpituous
November 2, 2023 12:38
— with
GitHub Actions
Inactive
allisonkarlitskaya
force-pushed
the
endpoint-close
branch
from
November 2, 2023 14:49
203f70e
to
3627ab3
Compare
allisonkarlitskaya
temporarily deployed
to
gh-cockpituous
November 2, 2023 14:49
— with
GitHub Actions
Inactive
allisonkarlitskaya
force-pushed
the
endpoint-close
branch
from
November 2, 2023 15:50
3627ab3
to
63a1cca
Compare
allisonkarlitskaya
temporarily deployed
to
gh-cockpituous
November 2, 2023 15:51
— with
GitHub Actions
Inactive
martinpitt
requested changes
Nov 3, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! The purpose of this is a bit vague, but I understand this is preparatory stuff for the really interesting bits 😁
allisonkarlitskaya
force-pushed
the
endpoint-close
branch
from
November 9, 2023 09:30
63a1cca
to
5e64dcc
Compare
allisonkarlitskaya
temporarily deployed
to
gh-cockpituous
November 9, 2023 09:30
— with
GitHub Actions
Inactive
The router currently keeps a mapping of open channels to the endpoints responsible for them. This presents two problems: - when we close down an endpoint, we need to iterate all open channels in order to determine which channels belong to that endpoint - it's possible to have active endpoints associated with the router which the router has no idea about Move to a more explicit model where we add a second mapping: endpoints to their set of open channels. This makes endpoint shutdown easier and adds the advantage that an endpoint with no channels can still be tracked by the router (with an empty channel list). The second point of this will be useful in future commits when the router (and not the routing rules) become responsible for ensuring that all endpoints are correctly shutdown. We need to adjust the beiboot code a bit to avoid a catch22 whereby the routing rule needs to exist before the router is initialized, but the Peer itself can only now exist after the router is initialized.
It's theoretically possible that the user might send multiple 'close' messages to a D-Bus channel, which would have a chance to be delivered because the channel doesn't close immediately (but rather waits for outstanding requests to complete). This is a pretty theoretical bug but it's going to get worse when we modify how the router shutdown works in the next commit.
Add a .do_close() virtual method at the Endpoint level. This is already implemented by Channel, but let's also add an implementation of it to Peer which shuts down the Peer in the usual way. When the bridge gets EOF we can now call this method on all endpoints instead of creating synthetic close messages for each channel. We also stop tracking open channels for knowing when the shutdown is complete, and track endpoints instead (which is a strictly tighter constraint, as it includes endpoints with no open channels). There's the small matter of the increasingly redundant shutdown() method on routing rules, but we can clean that up soon.
allisonkarlitskaya
force-pushed
the
endpoint-close
branch
from
November 9, 2023 11:16
5e64dcc
to
e7eb12d
Compare
allisonkarlitskaya
temporarily deployed
to
gh-cockpituous
November 9, 2023 11:16
— with
GitHub Actions
Inactive
martinpitt
approved these changes
Nov 9, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! That's clearer now.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.