我有一个包含清漆 nginx 和 2 个金字塔后端的设置,其中一个运行 socket.io 应用程序。所有堆栈都在我的本地开发计算机上正常工作,但我无法在生产计算机上使用 websocket 部分。当客户端 socket.io 尝试连接时导致 socketio 应用程序的错误的回溯:
[2012-11-20 14:32:00] "GET /socket.io/1/websocket/790777701707 HTTP/1.1" 101 - -
Traceback (most recent call last):
File "/var/pyramid/maxserver/eggs/gevent-0.13.8-py2.7-linux-i686.egg/gevent/greenlet.py", line 390, in run
result = self._run(*self.args, **self.kwargs)
File "/var/pyramid/maxserver/eggs/gevent_socketio-0.3.5_rc2-py2.7.egg/socketio/transports.py", line 226, in send_into_ws
websocket.send(message)
File "/var/pyramid/maxserver/eggs/gevent_websocket-0.3.6-py2.7.egg/geventwebsocket/websocket.py", line 350, in send
return self.send_frame(message, self.OPCODE_TEXT)
File "/var/pyramid/maxserver/eggs/gevent_websocket-0.3.6-py2.7.egg/geventwebsocket/websocket.py", line 340, in send_frame
self._write(combined)
File "/var/pyramid/maxserver/eggs/gevent-0.13.8-py2.7-linux-i686.egg/gevent/socket.py", line 515, in sendall
data_sent += self.send(_get_memory(data, data_sent), flags, timeout=timeleft)
File "/var/pyramid/maxserver/eggs/gevent-0.13.8-py2.7-linux-i686.egg/gevent/socket.py", line 483, in send
return sock.send(data, flags)
error: [Errno 32] Broken pipe
<Greenlet at 0xa449c0c: send_into_ws> failed with error
Traceback (most recent call last):
File "/var/pyramid/maxserver/eggs/gevent-0.13.8-py2.7-linux-i686.egg/gevent/greenlet.py", line 390, in run
result = self._run(*self.args, **self.kwargs)
File "/var/pyramid/maxserver/eggs/gevent_socketio-0.3.5_rc2-py2.7.egg/socketio/transports.py", line 230, in read_from_ws
message = websocket.receive()
File "/var/pyramid/maxserver/eggs/gevent_websocket-0.3.6-py2.7.egg/geventwebsocket/websocket.py", line 296, in receive
result = self._receive()
File "/var/pyramid/maxserver/eggs/gevent_websocket-0.3.6-py2.7.egg/geventwebsocket/websocket.py", line 244, in _receive
frame = self.receive_frame()
File "/var/pyramid/maxserver/eggs/gevent_websocket-0.3.6-py2.7.egg/geventwebsocket/websocket.py", line 177, in receive_frame
data0 = read(2)
File "/var/pyramid/maxserver/eggs/gevent_websocket-0.3.6-py2.7.egg/geventwebsocket/python_fixes.py", line 22, in readinto
return self._sock.recv_into(b)
File "/var/pyramid/maxserver/eggs/gevent-0.13.8-py2.7-linux-i686.egg/gevent/socket.py", line 472, in recv_into
wait_read(sock.fileno(), timeout=self.timeout, event=self._read_event)
File "/var/pyramid/maxserver/eggs/gevent-0.13.8-py2.7-linux-i686.egg/gevent/socket.py", line 169, in wait_read
switch_result = get_hub().switch()
File "/var/pyramid/maxserver/eggs/gevent-0.13.8-py2.7-linux-i686.egg/gevent/hub.py", line 164, in switch
return greenlet.switch(self)
timeout: timed out
<Greenlet at 0xa46157c: read_from_ws> failed with timeout
我检查了所有 python 包版本,两台计算机都相同。还将生产计算机升级到 libevent 1.4.14b 以匹配本地计算机。
我不知道用哪种方法来调试它。帮助表示赞赏!