Skip to content

Go: a full run grows GOCACHE without bound (235 GB) and fills the disk #17

Open

Description

@szybnev

What happens

A full run over a large Go codebase filled the disk. About 33,000 mutation sites in 65 packages ran for roughly 5 hours. Go's build cache (go env GOCACHE, ~/Library/Caches/go-build on macOS) grew to 235 GB. The disk reached 0 bytes free, and later packages failed with [Errno 28] No space left on device. Other processes on the machine failed too.

Why

Every mutant changes one source file, so go test compiles a new package archive and links a new test binary. Each binary is cached under a fresh key. With thousands of mutants per package, the cache grows by gigabytes per package and is never trimmed: Go's own trimming removes only entries unused for 5 days.

Workaround

Run with a private cache and remove it after each package:

GOCACHE=$PWD/target/gocache mutator ... ; go clean -cache

Suggestion

One of these, from simplest:

  1. Mention the disk cost in the README's Go section, together with the workaround.
  2. Give the mutant runs a cache under the run directory (target/mutation-workers/run-*/gocache), seeded from the user's cache or shared across workers, and delete it with the run.
  3. Run go clean -cache with GOCACHE set to the private cache between files.

Option 2 keeps dependency builds warm within a run and bounds disk use to one run.

Environment

mutator a5a0cb8, Go 1.27.1, macOS arm64, --max-workers 14.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions