New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/sys/windows/svc: test failures with "The specified service has been marked for deletion." #42211
Comments
cc @mattn |
@bcmills thank you for creating this issue. The error message is ERROR_SERVICE_MARKED_FOR_DELETE returned from DeleteService https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-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 https://docs.microsoft.com/en-us/sysinternals/downloads/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.
Alex |
Yes, tests of different packages can and often do run at the same time. |
Using a random service name might help |
Change https://golang.org/cl/267603 mentions this issue: |
Change https://golang.org/cl/267604 mentions this issue: |
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 Thank you. Alex |
Both? Note that it is also possible for a user to run |
(The |
I don't do that.
No argument from me.
Sure. I hardly ever use anything more than Alex |
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 <alex.brainman@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-10-18T23:04:17-eeed37f/windows-amd64-longtest
2020-10-09T02:54:20-dfb3f7c/windows-amd64-longtest
2020-08-19T03:55:08-9a32b3a/windows-amd64-longtest
2020-08-17T15:53:16-9781c65/windows-amd64-longtest
2020-08-17T08:59:35-3ff754b/windows-amd64-longtest
2019-11-20T15:59:48-bd43791/windows-amd64-longtest
2019-11-20T13:05:36-6bfc516/windows-amd64-longtest
2019-11-19T19:55:28-f068ffe/windows-amd64-longtest
2019-11-19T06:07:38-e882bf8/windows-amd64-longtest
2019-11-18T13:31:27-cf1e2d5/windows-amd64-longtest
2019-11-18T07:38:50-2f86c98/windows-amd64-longtest
2019-11-15T15:19:21-52ab431/windows-amd64-longtest
2019-11-05T14:28:33-ac3223d/windows-amd64-longtest
2019-10-29T15:55:21-f43be2a/windows-amd64-longtest
2019-10-25T09:01:51-53bf42e/windows-amd64-longtest
2019-10-25T02:14:31-6c3a3bf/windows-amd64-longtest
2019-10-24T07:30:52-e66fe6e/windows-amd64-longtest
2019-10-23T14:50:28-b69606a/windows-amd64-longtest
2019-10-22T10:09:44-742c48e/windows-amd64-longtest
CC @alexbrainman @zx2c4
The text was updated successfully, but these errors were encountered: