Group Wiki inaccessible after group recreation due to stale repository cache

Summary

After deleting and permanently removing a group, then recreating a group with the same name/path, the group wiki becomes inaccessible with the error "Could not access the Wiki Repository at this time." This affects both UI and API access to group wikis.

Steps to reproduce

  • Create a group (or import one)
  • Create a group wiki in the group
  • Delete and permanently remove the group
  • Create a new group with the same name/path as the deleted group
  • Attempt to access the group wiki page via UI or API

Also confirmed with backend engineer per slack conversation

I found the problem. The wiki repository cache isn’t expired after the group is deleted. After the group is recreated, Rails still thinks the group wiki repository exists (because the previous cache record is still there) and tries to create files in it. As a result, it fails with a “repository not found” error. Calling repository.expire_status_cache helped to restore the functionality. Related code: https://gitlab.com/gitlab-org/gitlab/-/blob/3a0e3bdfd823b9e4e6d58feac91f93e2590d0e22/app/models/wiki.rb#L311-320

Example Project

What is the current bug behavior?

  • Wiki page displays error: "Could not access the Wiki Repository at this time."
  • Gitaly logs show "repository not found for wiki"
  • Wiki page UI shows no buttons or functionality
  • API calls to create wiki pages fail

What is the expected correct behavior?

  • Group wiki should be accessible and functional
  • New wiki pages should be creatable via UI and API

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Patch release information for backports

If the bug fix needs to be backported in a patch release to a version under the maintenance policy, please follow the steps on the patch release runbook for GitLab engineers.

Refer to the internal "Release Information" dashboard for information about the next patch release, including the targeted versions, expected release date, and current status.

High-severity bug remediation

To remediate high-severity issues requiring an internal release for single-tenant SaaS instances, refer to the internal release process for engineers.

Edited by 🤖 GitLab Bot 🤖