SRS3.0ストリームオーバーラップRuntimeError:dictionary changed size during iteration

2802 ワード

参考SRS wiki:https://github.com/ossrs/srs/wiki/v3_CN_Snapshot
最新のsrs 3を使用する.0バージョンのストリームオーバーレイ機能では、長時間のテストを経て、次のエラーが発生しました.
[23/Jun/2017:23:15:56] ENGINE Error in 'main' listener >
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 iteration

Traceback (most recent call last):
  File "research/api-server/server.py", line 1048, in 
    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 exc
cherrypy.process.wspbus.ChannelFailures: RuntimeError('dictionary changed size during iteration',)

アラームメッセージ:SRSディレクトリresearch/api-server/server.py 930行、
サーバーに来て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!!