-
Notifications
You must be signed in to change notification settings - Fork 179
Description
I wrote a python3 windows service which uses waitress.
When the machine boots up, the service starts without problems. But if I stop the service, all subsequents restarts will fail on my call to create_server
Traceback (most recent call last):
File "C:\Program Files\Python39\lib\site-packages\waitress\trigger.py", line 174, in __init__
w.connect(connect_address)
OSError: [WinError 10055] An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\TRANSLATE\PROJECT\PFTranslate\app.py", line 120, in SvcDoRun
self.main()
File "C:\Program Files\TRANSLATE\PROJECT\PFTranslate\app.py", line 144, in main
self.server = create_server(app, host='0.0.0.0', port='5000')
File "C:\Program Files\Python39\lib\site-packages\waitress\server.py", line 78, in create_server
last_serv = TcpWSGIServer(
File "C:\Program Files\Python39\lib\site-packages\waitress\server.py", line 229, in __init__
self.trigger = trigger.trigger(map)
File "C:\Program Files\Python39\lib\site-packages\waitress\trigger.py", line 178, in __init__
if detail[0]!= errno.WSAEADDRINUSE:
TypeError: 'OSError' object is not subscriptable
There are two problems here: detail is not subsciptable (was it in python 2?), and then the returned error in detail.winerr is 10055, which is not errno.WSAEADDRINUSE ... so the workaround loop will never work.
When changing trigger.py line from
if detail[0]!= errno.WSAEADDRINUSE:
to
if detail.winerror!= errno.WSAEADDRINUSE and detail.winerror != errno.WSAENOBUFS:
the count reaches 10 and create_server() fails.
I know, this is a known problem of waitress under windows... but has anyone a workaround or solution ? Why does it happens only at service restart and not on first boot?
Thank you