fix(server): ensure server uploads "repodiag" blobs #4358
Merged
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.
The kopia server was not uploading any logs to the repository, because "repodiag" blob uploads would always fail.
The cause was the following: When the (log) repodiag blob PUT operation was initiated, the
Contextused for this operation was already canceled.The context used for blob uploads is passed to
repodiag.NewLogManagerwhen opening the repository. In the case of the kopia server, the repository is asynchronously opened inserver.Server.InitReposotoryAsync. The context passed torepo.Openis canceled after the "open repository" server task completes. This issue was introduced in #1691Change:
Use
context.WithoutCancel()instead of the context passed when the repo "diagnoser" is created.New tests are included to reproduce this failure and verify the fix.
Ref:
Thanks to: