Gitlab CI Multi Runner on Windows should Shut Down without timing out
This occurs with CI Multirunner 1.6.1 (current latest stable) and with my own git-dev-head personal builds. A windows runner agent registers properly with Windows NT Service model, appears in the Services list in windows, and can be started cleanly, but shutting down times out with an error. Screenshot is attached, the message in the details of the windows event message is "shutdown timedout".
Steps:
- register a windows runner if not already registered. It will now be in your windows services list (verify via SC QUERY)
- start and then stop the windows service, either from the NET START/STOP or SC (service control) command line apps or from the services gui via services.msc, or via powershell service control cmdlets.
Expected:
- service stops without error
Actual:
-
Shutdown always times out, even when the runner is idle.
-
If you ran from the commandline, the output would look like this in the elevated (Administrator: Command Prompt) window:
C:\WINDOWS\system32>net stop gitlab-runner
...........
The gitlab-runner service could not be stopped.
While It's reasonable to expect that if multi runner process is in the middle of executing a job it could take more than 15-20 seconds to shut down. I think if the multi runner is idle, it should shut down faster. I wonder what the idle runner is doing that takes so long to tear down.
In either case, a responsive windows service will send status updates to request additional time, while it is processing an orderly shutdown to avoid being summarily terminated after the default 20 seconds of "no request for additional time is received, assume process is deadlocked or otherwise broken, and terminate the process".
Update: I modified the constant 30 second shutdown interval to 90 seconds, and the idle runner still is not exiting properly. Something must be wrong with the runner shutdown control logic on windows.
