【发布时间】:2015-10-18 06:10:56
【问题描述】:
我正在使用 nginx 和 gunicorn 在 Ubuntu 服务器上运行 Django。我正在尝试做一些在我的本地机器上工作的多处理,但在我的服务器上的 gunicorn 工作人员超时之前一直挂起。
cpu_count = int(multiprocessing.cpu_count())
pool = Pool(processes = cpu_count)
result = pool.map_async(apiSimulAvail, rate_ranges)
result.wait()
...do some more stuff once all processes return
它挂在pool = Pool(processes = cpu_count)。我没有收到任何错误,gunicorn worker 只是超时并重新启动。
非常感谢任何关于为什么会发生这种情况和/或我如何解决它的迹象。谢谢。
【问题讨论】:
-
您在启动这些进程之前是否启动了任何线程?
-
“那个观点”是什么意思?如果进程挂起,可能是因为它从父进程、祖父进程或曾祖父进程继承了错误的同步状态。确保这种情况永远不会发生的最好的(可能是唯一的)方法是在任何线程启动后永远不要启动进程。
-
您使用的是哪个版本的 Python?
-
使用 Python 2.7 版
标签: python django ubuntu nginx gunicorn