Skip to content

fix: contain mutation subprocesses (port of sivchari/gomu#93) - #4

Merged
mcgoughprogress merged 3 commits into
mainfrom
fix/mutation-process-containment
Aug 31, 2026
Merged

mcgoughprogress merged 3 commits into
mainfrom
fix/mutation-process-containment

Conversation

@mcgoughprogress

Copy link
Copy Markdown
Owner

Port of upstream PR sivchari/gomu#93 by @paixaop, applied unmodified (commits 94680a1, 10b00e8, 87de180 fast-forward cleanly from main).

Summary

  • run mutation compilation and tests in bounded worker pools
  • propagate caller cancellation and CLI termination signals
  • terminate Unix process groups so timed-out test descendants cannot survive
  • cap captured output and set a configurable child Go memory target
  • reject duplicate mutant IDs and use collision-free overlay directories

Root cause (upstream)

exec.CommandContext terminated the immediate go test process on timeout, but a spawned test binary could remain alive and continue consuming resources. Mutation runs also created one goroutine per mutant, compilation had no timeout, and command output was buffered without a limit.

The command runner now places Unix children in a dedicated process group and kills the group on cancellation. The mutation timeout covers both compilation and testing, and cancellation propagates from the Cobra root context through file processing.

Child Go processes receive GOMEMLIMIT=2GiB by default. Set GOMU_CHILD_GOMEMLIMIT to override it.

Overlap with #3

This supersedes fork PR #3 (fix/overlay-mutant-dir-collision). Both fix the same two bugs:

#3's regression tests (overlay_test.go, engine_test.go) are not carried over by this port and would need porting separately if we want to keep them.

Validation

  • go build ./... — clean
  • make test — all 11 packages pass
  • make lint — fails locally with a pre-existing toolchain error (export data version 4 is greater than maximum supported version 2), reproduced on main unchanged; not introduced here

@mcgoughprogress
mcgoughprogress merged commit 0c73248 into main Aug 31, 2026
@mcgoughprogress
mcgoughprogress deleted the fix/mutation-process-containment branch August 31, 2026 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants