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

re-add grace period to Upload completer (again) #44941

Merged
merged 3 commits into from
Aug 1, 2024

Conversation

espadolini
Copy link
Contributor

@espadolini espadolini commented Aug 1, 2024

When a session completes, the corresponding session tracker is put into a terminated state and its expiry is updated so that it will naturally expire shortly in the future.

Teleport's upload completer runs periodically and looks for uploads for which there is not a session tracker. If it finds any, it assumes there was an error and that no more data will be uploaded so it completes or aborts the upload.

There is a race condition here - if the TTL of the terminated session tracker is shorter than the time it takes for the session to be uploaded or if the session tracker never existed in the first place, or is yet to be created, then the upload completer may mistakenly determine that a session tracker which just recently expired (and is still being uploaded) needs to be completed, causing the upload to be cut short.

This PR re-adds a 24 hour grace time to the upload completer, similar to the one that was removed in #11551 (and re-added for Teleport v9 backwards compatibility to v10 and v11 in #12471), but with the addition of a check against the time of the last uploaded part too, which means that the upload completer will only act on uncompleted sessions that haven't had a part uploaded in 24 hours, or that have no parts and whose "upload" is over 24 hours old.

Replaces #44910

changelog: fixed race condition between session recording uploads and session recording upload cleanup

@espadolini espadolini requested a review from zmb3 August 1, 2024 13:43
@github-actions github-actions bot requested review from gzdunek and kimlisa August 1, 2024 13:43
@github-actions github-actions bot added audit-log Issues related to Teleports Audit Log size/sm labels Aug 1, 2024
@espadolini espadolini force-pushed the espadolini/upload-completer-grace-time branch from 4686d99 to b9ff9d9 Compare August 1, 2024 13:47
@espadolini espadolini requested a review from rosstimothy August 1, 2024 13:55
@espadolini espadolini marked this pull request as draft August 1, 2024 14:42
@espadolini espadolini force-pushed the espadolini/upload-completer-grace-time branch from d9375b4 to 32809ff Compare August 1, 2024 14:44
@gravitational gravitational deleted a comment from github-actions bot Aug 1, 2024
@gravitational gravitational deleted a comment from github-actions bot Aug 1, 2024
@espadolini espadolini force-pushed the espadolini/upload-completer-grace-time branch from 32809ff to 3806e0a Compare August 1, 2024 14:51
@espadolini
Copy link
Contributor Author

👍

@espadolini espadolini marked this pull request as ready for review August 1, 2024 18:09
@github-actions github-actions bot requested review from gzdunek and smallinsky August 1, 2024 18:09
@espadolini espadolini removed the size/md label Aug 1, 2024
@espadolini espadolini added this pull request to the merge queue Aug 1, 2024
Merged via the queue into master with commit 3cef737 Aug 1, 2024
43 checks passed
@espadolini espadolini deleted the espadolini/upload-completer-grace-time branch August 1, 2024 18:52
@public-teleport-github-review-bot

@espadolini See the table below for backport results.

Branch Result
branch/v14 Create PR
branch/v15 Create PR
branch/v16 Create PR

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

Successfully merging this pull request may close these issues.

3 participants