SRS3.0 流叠图 RuntimeError: dictionary changed size during iteration

来源:互联网 发布:linux shutdown now 编辑:程序博客网 时间:2024/06/07 13:18

参考SRS wiki:https://github.com/ossrs/srs/wiki/v3_CN_Snapshot


在使用最新srs3.0版本流叠图功能时,经过长时间的测试,出现如下报错:

[23/Jun/2017:23:15:56] ENGINE Error in 'main' listener <bound method SrsWorker.main of <__main__.SrsWorker object at 0x26df690>>Traceback (most recent call last):  File "/usr/lib/python2.6/site-packages/CherryPy-3.2.4-py2.6.egg/cherrypy/process/wspbus.py", line 197, in publish    output.append(listener(*args, **kwargs))  File "research/api-server/server.py", line 930, in main    for url in self.__snapshots:RuntimeError: dictionary changed size during iterationTraceback (most recent call last):  File "research/api-server/server.py", line 1048, in <module>    cherrypy.quickstart(root, '/', conf)  File "/usr/lib/python2.6/site-packages/CherryPy-3.2.4-py2.6.egg/cherrypy/__init__.py", line 174, in quickstart    engine.block()  File "/usr/lib/python2.6/site-packages/CherryPy-3.2.4-py2.6.egg/cherrypy/process/wspbus.py", line 302, in block    self.wait(states.EXITING, interval=interval, channel='main')  File "/usr/lib/python2.6/site-packages/CherryPy-3.2.4-py2.6.egg/cherrypy/process/wspbus.py", line 357, in wait    _wait()  File "/usr/lib/python2.6/site-packages/CherryPy-3.2.4-py2.6.egg/cherrypy/process/wspbus.py", line 344, in _wait    self.publish(channel)  File "/usr/lib/python2.6/site-packages/CherryPy-3.2.4-py2.6.egg/cherrypy/process/wspbus.py", line 215, in publish    raise exccherrypy.process.wspbus.ChannelFailures: RuntimeError('dictionary changed size during iteration',)

报警提示:在SRS目录research/api-server/server.py  930行,

来到server.py文件

class SrsWorker(cherrypy.process.plugins.SimplePlugin):    def __init__(self, bus):        cherrypy.process.plugins.SimplePlugin.__init__(self, bus);        self.__snapshots = {}    def start(self):        print "srs worker thread started"    def stop(self):        print "srs worker thread stopped"    def main(self):        for url in self.__snapshots:  //930行            snapshot = self.__snapshots[url]                        diff = time.time() - snapshot['timestamp']            process = snapshot['process']                        # aborted.            if process is not None and snapshot['abort']:                process.kill()                process.poll()                del self.__snapshots[url]                print 'abort snapshot %s'%snapshot['cmd']                break

将其修改为 for url in self.__snapshots.keys():

重新运行 :

python research/api-server/server.py 8085

ok了!!



原创粉丝点击