fix: contain mutation subprocesses (port of sivchari/gomu#93) - #4
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port of upstream PR sivchari/gomu#93 by @paixaop, applied unmodified (commits 94680a1, 10b00e8, 87de180 fast-forward cleanly from
main).Summary
Root cause (upstream)
exec.CommandContextterminated the immediatego testprocess 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=2GiBby default. SetGOMU_CHILD_GOMEMLIMITto override it.Overlap with #3
This supersedes fork PR #3 (
fix/overlay-mutant-dir-collision). Both fix the same two bugs:internal/mutation/engine.goassignsID = fmt.Sprintf("%s_%d", filePath, len(allMutants))inside the type-check accept branch. Byte-identical to fix: isolate mutant overlay directories and make mutant IDs unique #3's commit 1ce9da4.internal/execution/overlay.go. Upstream usesos.MkdirTemp(om.baseDir, "mutant-*"); fix: isolate mutant overlay directories and make mutant IDs unique #3 used anatomic.Uint64sequence. Equivalent effect, different mechanism.#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 ./...— cleanmake test— all 11 packages passmake lint— fails locally with a pre-existing toolchain error (export data version 4 is greater than maximum supported version 2), reproduced onmainunchanged; not introduced here