-
Notifications
You must be signed in to change notification settings - Fork 109
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
Mirrord connection reconnect #3000
base: main
Are you sure you want to change the base?
Mirrord connection reconnect #3000
Conversation
Quality Gate passedIssues Measures |
…roxy-randomly-closes-during-connection
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.
Mostly questions for my own understanding, and a couple of bits and pieces :)
…roxy-randomly-closes-during-connection
…roxy-randomly-closes-during-connection
…roxy-randomly-closes-during-connection
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.
noice 🦅
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.
Beyond what's in the comments:
- I think we need to check if operator supports reconnecting (new operator feature). Otherwise things will get wild.
FilesProxy
is never informed about the reconnect, and it is very stateful (queues expected responses, caches dir entries and file contents). This scares me 👀 Same applies to the ping pong task.- Not that I want to force my idea, but I think we can do sth simpler:
- Let the
AgentConn
task fail in peace. - When
IntProxy
picks it up, it enters a resetting state. It notifies all relevant tasks with a new message variant (e.gReset
). Then, it makes a new agent connection and starts a newAgentConn
task. For each task that was sent aReset
,IntProxy
memorizes that it expects one moreResetAck
from it. - When a task gets the
Reset
command, it immediately responds withResetAck
. Then it does all necessary housekeeping, like cleaning state, sending error responses to the layer (for requests in progress), resending port subscriptions to the agent, dropping local connections, resetting ping pong state. - Intproxy ignores all messages from a resettable task until it gets expected count of
ResetAck
s. - Due to layer storing remote file descriptors, we'd have to create an independent mapping in the
FilesProxy
and make sure not to let through any requests for unknown remote fds. - If it doesn't do that yet,
BackgroundTasks
should remove the task's receiver from the streammap when this task exits (in order to drop all previous messages)
- Let the
Let me know what you think 'bout this
for subscription in self.subscriptions.iter_mut() { | ||
tracing::debug!(?subscription, "resubscribing"); | ||
|
||
for message in subscription.resubscribe() { | ||
message_bus.send(ProxyMessage::ToAgent(message)).await | ||
} | ||
} |
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.
As far as IncomingProxy
is concerned, these subscriptions were already confirmed. This looks kind of sus, I'd check out handling of DaemonTcp::PortSubscribe
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.
Well this is assuming that all agent side connections are dead thus we need someone to ask the agent to perform the subscription again so user's app isn't required to re-listen on incoming socket (like intproxy will just recreate the incoming tasks with new listens results)
…roxy-randomly-closes-during-connection
Co-authored-by: Michał Smolarek <[email protected]>
Add reconnect option for operator to fix #2901