Skip to content

Reload stale job artifacts in the trace class

Shinya Maeda requested to merge fix-race-condition-of-trace-handling into master

What does this MR do?

This MR fixes a race condition in the job trace processing class. It currently memoizes the job_artifacts_trace into the cache, however, we should ask the database every time, as its state could be updated by other threads, such as the archive trace worker.

Also, we should not allow writing a trace if it's already archived. "Archive" means it's completed and not changed. It should be a read-only entry.

Does this MR meet the acceptance criteria?

  • Changelog entry added, if necessary
  • Tests added for this feature/bug
  • Conform by the code review guidelines
    • Has been reviewed by a Backend maintainer
  • End-to-end tests pass (package-and-qa manual pipeline job)

What are the relevant issue numbers?

Related https://sentry.gitlap.com/gitlab/gitlabcom/issues/225044/

Edited by Shinya Maeda

Merge request reports