You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Repeatedly starting and stopping StationServer (e.g. in unit tests) reveals some race conditions in OpenHTF and Tornado.
In openhtf/output/servers/web_gui_server.py:160: AttributeError: 'StationServer' object has no attribute 'server'
This happens if you call stop() on the server before the run() thread has finished setting up the server
In tornado/tcpserver.py:260: KeyError: 11
I'm not sure why you'd hit this, but it also happens sometimes when you call StationServer's stop() method.
One workaround is to wrap it in a new context manager like
importcontextlibimporttimeimporttypingimportopenhtf.output.servers.station_server@contextlib.contextmanagerdefsafe_station_server() ->typing.Generator[openhtf.output.servers.station_server.StationServer, None, None]:
"""Workaround for race conditions in StationServer and Tornado libraries."""server=openhtf.output.servers.station_server.StationServer()
server.start()
whilenothasattr(server, "server"):
time.sleep(0)
yieldservertry:
server.stop()
exceptKeyError:
pass
The text was updated successfully, but these errors were encountered:
Repeatedly starting and stopping StationServer (e.g. in unit tests) reveals some race conditions in OpenHTF and Tornado.
In openhtf/output/servers/web_gui_server.py:160: AttributeError: 'StationServer' object has no attribute 'server'
This happens if you call
stop()
on the server before therun()
thread has finished setting up the serverIn tornado/tcpserver.py:260: KeyError: 11
I'm not sure why you'd hit this, but it also happens sometimes when you call
StationServer
'sstop()
method.One workaround is to wrap it in a new context manager like
The text was updated successfully, but these errors were encountered: