Repository navigation
Harness: start the tagged child a second later in AW's Process.Start reader-failure cases - #123
Merged
Merged
Conversation
…ograms a list is quoted for
The dispatcher checks for an abort once per pass, and its start loop read only the token, which that check cancels. So a Ctrl+C landing while the loop was starting programs, or a -JobStarter that requested an abort, still filled every free slot on that pass. The start loop now also reads the abort flag before each job, ahead of the shared budget's Wait(0) so no slot is taken for a job that won't start. Harness section O covers a -JobStarter that requests an abort, with a plain limit and with a shared budget.
The test that kills a live tree listed beside a disposed process counted leftover pings right after Stop-PkProcessTree returned. Ending a Job Object returns before Windows has finished tearing its processes down, so on a CI runner the ping was still listed once. It now waits up to 5 seconds for it to go, as the other kill tests do.
…Exit doesn't warn after the kit's own kill With -KillTreeOnExit, a program the kit killed (for its time limit, Invoke-PkProcessWithTimeout's limit, or an abort's force-stop) got the warning that it "has no Job Object of its own". KillTree closed the program's tree job once it had ended it, so -KillTreeOnExit, ending it again once the program had exited, found no tree job. KillTree now leaves the tree job open: a second KillTree ends an empty job and succeeds, quietly. Complete-PkProcess closes it as before, and so do the force-stop and Invoke-PkProcessWithTimeout's cleanup, which dispose a killed program without completing it. Harness section BJ covers the three kills; BF's check that a kill releases the tree job now expects the release at Complete-PkProcess, and a second KillTree to succeed. The README's Limits also says a program whose path is over 260 characters can't be started: Windows refuses it, long paths enabled or not.
… every dispatcher kill test On CI, 'a -JobFinalize that throws gets no -JobAbortCleanup for its finished job' failed under Windows PowerShell 5.1 with 1 ping left: it counted leftover pings right after the dispatcher's teardown kill, and ending a Job Object returns before Windows has torn its processes down. Five other tests count the same way. They now all use one helper, Get-LimitPingLeft, which waits up to 5 seconds for the pings to go, and still fails one that survives.
…reader-failure cases On the Process.Start path a program runs before the kit adds it to its Job Object, so a child it starts straight away can start outside its tree job and survive the kill, the gap the README's Limits gives for AddedToJob. Two AW tests started their tagged ping straight away on that path, and on a slow CI runner one failed with the ping left running. On that path the ping now starts about a second later, after the program is in its Job Object, and the failing reader start waits until it's up.
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.
What was wrong: the CI run on
mainafter #119 failed one assertion under PowerShell 7, in the module step: "a program whose stderr reader can't start is ended and the start reported as failed, Process.Start (1 left running, ...)". On theProcess.Startpath a program runs before the kit adds it to its Job Object. So a child it starts straight away can start outside its tree job and survive the kill, the gap the README's Limits gives forAddedToJobmode. The test's program,cmd /d /c ping -n 30 -w <tag> ..., starts its ping at once, and a slow runner let the ping in ahead of the kit once. The test added in #115 ("a program that has exited when its reader fails ..., Process.Start") has the same race. It hasn't failed yet. Not a kit bug.What changed: test-only. In both tests'
Process.Startcase, cmd.exe now waits about a second (ping -n 2) before starting the tagged ping, so the ping starts after cmd.exe is in its Job Object. The failing reader start is held withTestFailRunDelayMs(2.5 s, and 3.5 s where cmd.exe also has to exit first), so the ping is up when the rollback runs. TheCreatedInJoband batch cases are unchanged: there the program is created inside its Job Object, so there's no gap.One trade-off: nothing checks that the tagged ping was up when the rollback ran. A runner that stalled cmd.exe for over 2.5 s would pass without testing the child kill.
How it was tested: a race that failed once on CI can't be shown failing on demand. Section AW passes on both runtimes, and all 779 assertions of the full harness pass on Windows PowerShell 5.1 and on PowerShell 7.