所以我有一个需要与gunicorn --worker-class eventlet
一起运行的烧瓶应用。
但是当我在iterm2窗格中启动这样的app时,当我调整窗格大小时(发送绞盘信号),工作人员崩溃了:
[2016-11-07 11:03:38 +0800] [57382] [INFO] Handling signal: winch
[2016-11-07 11:03:38 +0800] [57385] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 557, in spawn_worker
worker.init_process()
File "/usr/local/lib/python2.7/site-packages/gunicorn/workers/geventlet.py", line 96, in init_process
super(EventletWorker, self).init_process()
File "/usr/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 132, in init_process
self.run()
File "/usr/local/lib/python2.7/site-packages/gunicorn/workers/geventlet.py", line 125, in run
eventlet.sleep(1.0)
File "/usr/local/lib/python2.7/site-packages/eventlet/greenthread.py", line 34, in sleep
hub.switch()
File "/usr/local/lib/python2.7/site-packages/eventlet/hubs/hub.py", line 294, in switch
return self.greenlet.switch()
File "/usr/local/lib/python2.7/site-packages/eventlet/hubs/hub.py", line 346, in run
self.wait(sleep_time)
File "/usr/local/lib/python2.7/site-packages/eventlet/hubs/kqueue.py", line 100, in wait
result = self._control([], self.MAX_EVENTS, seconds)
File "/usr/local/lib/python2.7/site-packages/eventlet/hubs/kqueue.py", line 43, in _control
return self.kqueue.control(events, max_events, timeout)
OSError: [Errno 4] Interrupted system call
[2016-11-07 11:03:38 +0800] [57385] [INFO] Worker exiting (pid: 57385)
Exception TypeError: TypeError("'NoneType' object is not callable",) in <bound method Client.__del__ of <etcd.client.Client object at 0x10290a5d0>> ignored
[2016-11-07 11:03:38 +0800] [57394] [INFO] Booting worker with pid: 57394
供参考: *我也在我的代码中使用grpc。 *这不会发生在我的远程centos 7服务器上,只有我的mac
答案 0 :(得分:0)
在调整大小之前执行此操作。
import signal
signal.signal(signal.SIGWINCH, signal.SIG_IGN)
我认为它应该包含在gunicorn初始化中。