Skip to content

gitserver: low disk space causes clean and clone loop

Created by: chrismwendt

  • Sourcegraph version: latest
  • Platform information: N/A

Steps to reproduce:

  1. Fill your disk to just over 90% to trigger cleaning which kicks in at 10% free by default (SRC_REPOS_DESIRED_PERCENT_FREE=100 might repro as well, but I haven't tried it)
  2. Add a repo

Expected behavior:

Sourcegraph avoids cloning the repo (or clones it, realizes it's too big, then deletes it). It should not enter a loop.

Actual behavior:

  • Watch the gitserver logs in stdout for messages that say: [gitserver] ERROR cleanup: error freeing up space, error: only freed 3072440 bytes, wanted to free 676451532
  • Followed by [gitserver] INFO cloning repo
  • Followed by [gitserver] ERROR cleanup: error freeing up space, error: only freed 3072440 bytes, wanted to free 676451532 (again)
  • Followed by ... repeatedly forever.

Code that does the cleanup: https://github.com/sourcegraph/sourcegraph/blob/1ab959b7b793860f55e6fd2cb3b1fabd4c44621e/cmd/gitserver/server/cleanup.go#L372