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

Terminated session viewable and joinable in webui after restarting Node #13714

Open
Tracked by #17028
Joerger opened this issue Jun 21, 2022 · 1 comment
Open
Tracked by #17028

Comments

@Joerger
Copy link
Contributor

Joerger commented Jun 21, 2022

Expected behavior:

Restart Teleport Node (^C) -> No active sessions on restart.

Current behavior:

Any session which was open during the restart will show up in the WebUI. You can also join the session on the WebUI, which will create a new session with the same ID, since the session doesn't actually exist. This was a weird user experience, and initially I thought there was a file leak on the Teleport Node.

Bug details:

Proposal

We have a few other similar issues which occur with non-graceful restart ^C

And we have some related fixes already in place:

  • UploadCompleter uploads abandoned session uploads
    • It also emits a session.end event if it is missing

Improving graceful restart would be good, but it still wouldn't handle the case where the process is killed, etc.

Instead, we can expand the UploadCompleter to be a SessionCompleter and handle all related issues. It could exist in the Session service and work more closely with the SessionRegistry. This will also solve some racy issues with the UploadCompleter as it is now.

For now, it would find session trackers which don't have a corresponding session in the session registry, then, if applicable:

  • Close associated unix sockets (x11 forwarding and agent forwarding)
  • Complete uploading of the session recording
  • Delete loose files (like the session upload place holder part file)
  • Emit a session end event
  • Delete the session tracker

For this to work, we'd need to remove the session tracker expiration (1 hour, extending during session lifetime), and instead track the sessions manually. This way, an abandoned upload would have an abandoned tracker, so we could move the upload completion logic to the SessionCompleter. To make this backwards compatible, we'd need to deprecate UploadCompleter over the next major version, which shouldn't be a problem since it won't overlap with the SessionCompleter.

@xacrimon
Copy link
Contributor

Note: This became evident in v10 as we started to query sessions using trackers instead of the legacy system. This wasn't noticed too much as the legacy system had a very short heartbeat that traded heavy backend load for this issue. The reason for avoiding such a short timeout is that the auth could drop the session if the node lost connection or the network was bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants