WebSocket-for-Python icon indicating copy to clipboard operation
WebSocket-for-Python copied to clipboard

GEventWebSocketPool.clear problem

Open koliyo opened this issue 11 years ago • 1 comments
trafficstars

Hello!

Im running a WebSocket server using gevent, and inside a coroutine I call server.stop()

this results in the following exception:

File "/Volumes/Work/agx/Lars/remote_sim_view_site/sim_view_app/tasks.py", line 156, in shutdown
self.webSocketServer.stop()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ws4py/server/geventserver.py", line 106, in stop
self.pool.clear()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ws4py/server/geventserver.py", line 79, in clear
for greenlet in self:
RuntimeError: Set changed size during iteration
<Greenlet at 0x10e2c02d0: <bound method SimulationTaskManager.timeoutHandler of <sim_view_app.tasks.SimulationTaskManager instance at 0x10e0da998>>> failed with RuntimeError

I can resolve the problem by applying the following patch to GEventWebSocketPool.clear

- for greenlet in self:
+ for greenlet in list(self):

koliyo avatar May 07 '14 08:05 koliyo

Bump

kpelelis avatar Jul 12 '17 13:07 kpelelis