首页 > 解决方案 > 为什么导入 uuid 会导致 uwsgi 守护进程挂起?

问题描述

我可以使用 uwsgi 执行以下 WSGI 程序(当 uwsgi 作为 systemd 运行时)。

def application(env, start_response):
  start_response('200 OK', [('Content-Type','text/html')])
  return [b"Hello world"]

但是,如果我尝试导入 uuid 模块,程序将挂起并最终超时。但是直接用 uwsgi 运行程序就可以了:

uwsgi --socket 0.0.0.0:8000 --protocol=http -w myapp

为什么 uuid 会导致 uwsgi 挂起?

标签: pythonuwsgiwsgi

解决方案


在我的 INI 文件中,设置 threads = 2 是导致导入 uuid 挂起的原因。


推荐阅读