TOLLado IOLoop被EPOLLOUT无限地唤醒,占用了100%的CPU

时间:2016-09-28 08:47:32

标签: python-2.7 ubuntu-14.04 tornado epoll strace

我在tornado 4.4.1中使用Ubuntu 14.xx WebsocketHTTP服务器。

我已经运行了几天。

与此同时,我发现IoLoop线程需要100%的CPU使用率。

我通过strace -p IoLoopthreadId检查线程执行的操作。

跟踪说IoLoop epoll_waitEPOLLOUT无限地唤醒ioloop.IOLoop.instance().start()

我只是使用IoLoop来生成class ConvPlayerInterface(object): logger = logging.getLogger("Player.PlayerInterface") queue = ipcQueue.IpcQueue(maxsize=50) class WebsocketHandler(websocket.WebSocketHandler): client = [] def open(self): ConvPlayerInterface.logger.info('PlayerInterface is Opened') self.client.append(self) #It consider that only one client is handled. def on_message(self, message): ConvPlayerInterface.logger.info("Receive PlayerInterface Message : %s" % message) ConvPlayerInterface.queue.put(message) def on_close(self): ConvPlayerInterface.logger.info('PlayerInterface is closed') self.client.remove(self) def check_origin(self, origin): return True def get(self): jsonStr = self.queue.get() return json.loads(jsonStr) def getAll(self): jsonStrList = self.queue.getAll() jsonObjList = [json.loads(_jsonStr) for _jsonStr in jsonStrList] return jsonObjList def put(self, command): for client in self.WebsocketHandler.client: client.write_message(command) ConvPlayerInterface.logger.info('Emitted PlayerInterface Message : %s' % command) def execute(self, command, rtnCmd): pass class TornadoManager(threading.Thread): def __init__(self, location): threading.Thread.__init__(self) _djangoWsgi = djangoWsgi.get_wsgi_application() self.tornadoWsgiContainer= tornadoWsgi.WSGIContainer(_djangoWsgi) self.ip, self.port = location.split(":") self.tornadoApp = web.Application([ (r"/list/socket", playerInterface.ConvPlayerInterface.WebsocketHandler), (r'/static/(.*)', web.StaticFileHandler, {'path': os.path.join(os.path.dirname(__file__), "static")}), (r".*", web.FallbackHandler, dict(fallback=self.tornadoWsgiContainer)), ], debug=False ) self.server = httpserver.HTTPServer(self.tornadoApp) self.server.listen(self.port, self.ip) def run(self): print "Start Tornado IOLoop - %s:%s" % (self.ip, self.port) ioloop.IOLoop.instance().start() 主题。

这种情况有什么用?

我该如何解决?

请给我任何建议。

enter image description here

------------------ EDIT ---------------------

以下是关于龙卷风的代码部分。

此外,如果在龙卷风尝试发送消息时端点(websocket)处于无响应状态并保持连接,那么它是否会出现此问题呢?

compile ('com.android.support:cardview-v7:24.1.1') {
exclude module: 'support-v4'
  }

0 个答案:

没有答案