x/sys/windows/svc: test failures with "The specified service has been marked for deletion." #42211
@bcmills thank you for creating this issue.
The error message is ERROR_SERVICE_MARKED_FOR_DELETE returned from DeleteService
Interestingly, when we see a failure, both golang.org/x/sys/windows/svc and golang.org/x/sys/windows/svc/mgr tests fail. To me this sounds like package tests interfere with each other. In fact both test install the same service (same name and source). I wonder, if golang.org/x/sys/windows/svc and golang.org/x/sys/windows/svc/mgr run at the same time. Is this possible? If yes, then this can certainly happen.
I have seen this error before DeleteService was run while service process was still running.
I have also run
for /l %i in (1 1 10) do go test -count=1 golang.org/x/sys/windows/svc/...
and this command runs fine.
But, if I interrupt my test by pressing Ctrl+C, this happens
and I can see service process is still running. I used Process Explorer
and I know service executable is called a.exe
And indeed, if I start my test again, I see the error.
But, if I stop service with
I can see a.exe process disappears. And I can run my test again.
I am surprised. Are you talking about builders or
Good half-advice. I will rename service in one of the tests - that should be good enough. I don't like the
Both? Note that it is also possible for a user to run
I don't do that.
No argument from me.
Sure. I hardly ever use anything more than
TestExample normally stops and deletes test service at the end of the test. But, if TestExample does not complete for some reason, test service might remain running and installed. There is some code that deletes "left over" test service before starting the test. But that code fails, if service is running. Deletion only works, if service is not running. This CL adds code to stop the "left over" service so it can be deleted. Update golang/go#42211 Change-Id: I826dd587063265c5b96076668c3704c0a7eaa3d8 Reviewed-on: https://go-review.googlesource.com/c/sys/+/267603 Run-TryBot: Alex Brainman <email@example.com> TryBot-Result: Go Bot <firstname.lastname@example.org> Trust: Alex Brainman <email@example.com> Reviewed-by: Ian Lance Taylor <firstname.lastname@example.org>