Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Error creating Windows Service, encoding issue calling Win32 Service API #3796
buildbot: latest from github
The error when trying to start the service is :
Error starting service: The service did not respond to the start or control request in a timely fashion. Debugging service BuildBot - press Ctrl+C to stop. ****************** b'...\\worker_dir' Error 0xC0000003 - The instance's SvcRun() method failed Traceback (most recent call last): File "...\env\lib\site-packages\win32\lib\win32serviceutil.py", line 835, in SvcRun self.SvcDoRun() File "..\env\lib\site-packages\buildbot_worker-2017.12.2-py3.6.egg\buildbot_worker\scripts\windows_service.py", line 226, in SvcDoRun if not self._checkConfig(): File "..\env\lib\site-packages\buildbot_worker-2017.12.2-py3.6.egg\buildbot_worker\scripts\windows_service.py", line 211, in _checkConfig dir_string) File "..\env\lib\site-packages\win32\lib\win32serviceutil.py", line 272, in SetServiceCustomOption win32api.RegSetValueEx(key, option, 0, win32con.REG_SZ, value); TypeError: Objects of type 'bytes' can not be converted to Unicode.
A quick and dirty monkey patch to get past the error:
dir_string = os.pathsep.join(self.dirs).encode("mbcs")
dir_string = os.pathsep.join(self.dirs)
That was the only monkey patch, but I could only get the worker service to start in
So I abandoned it for a dirty workaround:
sc create buildbot binPath= "%BUILDBOT_WORKER_EXE% start %WORKER_DIR%" error= ignore obj= %YOUR_DOMAIN_OR_DOT%\%USERNAME% password= %PASSWORD start= auto depend= tcpip DisplayName= "Buildbot Worker" sc start buildbot
But with that method windows says the service doest start, because it not correctly responding to the Windows management signals, however, the worker is running. hacky I know.
Although it would be better to fix the root cause, my next step would probably be to use https://nssm.cc/
added a commit
Dec 3, 2017
When exiting the service with
Exception in thread Thread-1: Traceback (most recent call last): File "C:\cygwin64\home\wayne\buildbot_windows_10_env\lib\site-packages\buildbot_worker-2017.12.2-py3.6.egg\buildbot_worker\scripts\windows_service.py", line 408, in redirectCaptureThread ec, data = win32file.ReadFile(handle, CHILDCAPTURE_BLOCK_SIZE) pywintypes.error: (109, 'ReadFile', 'The pipe has been ended.') During handling of the above exception, another exception occurred: Traceback (most recent call last): File "c:\program files\python36\Lib\threading.py", line 916, in _bootstrap_inner self.run() File "c:\program files\python36\Lib\threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "C:\cygwin64\home\wayne\buildbot_windows_10_env\lib\site-packages\buildbot_worker-2017.12.2-py3.6.egg\buildbot_worker\scripts\windows_service.py", line 412, in redirectCaptureThread if err != winerror.ERROR_BROKEN_PIPE: TypeError: 'error' object does not support indexing Info 0x40001004 - The BuildBot service has stopped (BuildBot).
We are looking for windows/python experts to fix the integration, especially with the service stuff. Feel free to propose enhancements. If this is a complete rewrite using more modern stuff, I think this would be fine.
@WayneKeenan thanks for posting that stacktrace. I think we can fix this.
In the line where it throws the exception, can you print out the members of err:
I'm nat at my Windows machine right now, so need to figure out which member of err to