OpenSight / janus-cloud

a cluster solution for Janus WebRTC server, by API proxy approach
GNU Affero General Public License v3.0
205 stars 49 forks source link

websocket server failed with gevent of new version #47

Closed hyt-hz closed 1 year ago

hyt-hz commented 1 year ago

With gevent==22.10.2 and greenlet==2.0.1, websocket server failed to handle new connection.

2023-06-26 21:45:01,709 [138221] [ws4py] [INFO] - Managing websocket [Local => 127.0.0.1:8288 | Remote => 127.0.0.1:35588]
2023-06-26 21:45:01,710 [138221] [januscloud.transport.ws] [INFO] - Closed websocket server connection with ('127.0.0.1', 35588): Going away
Traceback (most recent call last):
  File "src/gevent/greenlet.py", line 908, in gevent._gevent_cgreenlet.Greenlet.run
  File "/opensight/pyenv/janus_cloud/lib64/python3.9/site-packages/ws4py/websocket.py", line 526, in run
    self.opened()
  File "/root/deploy/janus-cloud-master/januscloud/transport/ws.py", line 72, in opened
    self.sock.sendall = sendall
AttributeError: 'socket' object attribute 'sendall' is read-only
2023-06-26T13:45:01Z <Greenlet at 0x7f6e59f26b80: <bound method WebSocket.run of <januscloud.transport.ws.WSServerConn object at 0x7f6e59decf70>>> failed with AttributeError

The offending code is used to prevent sending message from multiple greenlets concurrently.