Skip to content

Stop task runner before reaper in test teardown#835

Open
jy5275 wants to merge 1 commit intocanonical:masterfrom
jy5275:fix/reaper-stop
Open

Stop task runner before reaper in test teardown#835
jy5275 wants to merge 1 commit intocanonical:masterfrom
jy5275:fix/reaper-stop

Conversation

@jy5275
Copy link
Copy Markdown
Contributor

@jy5275 jy5275 commented Apr 2, 2026

This PR solves issue#747.

To reproduce the that locally:

  • In internals/overlord/servstate/manager_test.go change four plans to period: 1ms
  • Then run while go test -race ./internals/overlord/servstate -count=10 -p 16 > /tmp/err; do date; done

You will probably see current master branch runs into panic within 3 loop rounds.

The reason is that: in internals/overlord/servstate/manager_test.go, TearDownTest calls reaper.Stop() without first stopping the task runner. This may cause a race condition where some tasks still fire goroutines and calling reaper.StartCommand, which panics if the reaper has been stopped.

Fix this by calling s.runner.Stop() before reaper.Stop().

I ran the issue-reproducing commands again for about 20+ loop rounds without panic locally.

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.

1 participant