python sanic 服务器启动失败 [INFO] Server Stopped 问题处理
[Python] 纯文本查看 复制代码 [2023-11-16 17:58:55 +0800] [7287] [DEBUG] Starting a process: Sanic-Server-0-0
[2023-11-16 17:58:56 +0800] [7287] [DEBUG] Starting a process: Sanic-Reloader-0
[2023-11-16 17:59:03 +0800] [7287] [ERROR] Not all workers are ack. Shutting down.
[2023-11-16 17:59:03 +0800] [7287] [ERROR] Experienced exception while trying to serve
Traceback (most recent call last):
File "/data/pyenv/pysanic3/lib/python3.9/site-packages/sanic/mixins/startup.py", line 851, in serve
manager.run()
File "/data/pyenv/pysanic3/lib/python3.9/site-packages/sanic/worker/manager.py", line 63, in run
self.monitor()
File "/data/pyenv/pysanic3/lib/python3.9/site-packages/sanic/worker/manager.py", line 99, in monitor
self.wait_for_ack()
File "/data/pyenv/pysanic3/lib/python3.9/site-packages/sanic/worker/manager.py", line 139, in wait_for_ack
sys.exit(1)
SystemExit: 1
[2023-11-16 17:59:03 +0800] [7287] [INFO] Server Stopped
解决方法:
/data/pyenv/pysanic3/lib/python3.9/site-packages/sanic/worker/manager.py
manager.py 文件的 line 139, in wait_for_ack 相关语句注释掉
[Python] 纯文本查看 复制代码 def wait_for_ack(self): # no cov
misses = 0
while not self._all_workers_ack():
sleep(0.1)
misses += 1
# if misses > self.THRESHOLD:
# error_logger.error("Not all workers are ack. Shutting down.")
# self.kill()
# sys.exit(1)
遇到相同问题的同学可以借鉴 一下了。
|