集成gunicorn、flask、twisted,出现错误 Unexpected error in main loop.exceptions.SystemExit: 1

集成gunicorn+flask+twisted,其中:

  • gunicorn做web server
  • flask做web framework
  • twisted做后台socket通讯

出现如下错误:

Unexpected error in main loop.exceptions.SystemExit: 1
2019-03-01 16:22:19+0800 [-] Unhandled Error
	Traceback (most recent call last):
	  File "/usr/lib/python2.7/site-packages/gunicorn/util.py", line 350, in import_app
	    __import__(module)
	  File "/home/p-api/papiflask.py", line 6, in <module>
	    import papirpcclient
	  File "/home/p-api/papirpcclient.py", line 178, in <module>
	    reactor.run()
	  File "/usr/lib64/python2.7/site-packages/twisted/internet/base.py", line 1267, in run
	    self.mainLoop()
	--- <exception caught here> ---
	  File "/usr/lib64/python2.7/site-packages/twisted/internet/base.py", line 1279, in mainLoop
	    self.doIteration(t)
	  File "/usr/lib64/python2.7/site-packages/twisted/internet/epollreactor.py", line 218, in doPoll
	    l = self._poller.poll(timeout, len(self._selectables))
	  File "/usr/lib/python2.7/site-packages/gunicorn/workers/gthread.py", line 112, in handle_quit
	    sys.exit(0)
	exceptions.SystemExit: 0
	
[2019-03-01 16:22:20 +0000] [18372] [INFO] Shutting down: Master