我正在使用nginx,uwsgi和SQLAlchemy的設定.我最近從SQLObject切換,現在我看到SQLAlchemy出現奇怪的隨機錯誤.例如:
sqlalchemy.exc.ResourceClosedError: This result object does not return rows. It has been closed automatically.
要么:
sqlalchemy.exc.NoSuchColumnError: "Could not locate column in row for column 'module.id'"
這是SQLAlchemy中的一種我不知道的行為嗎?它可以與uwsgi中的多個行程/執行緒相關嗎?
我的uwsgi組態檔如下所示:
[uwsgi]
plugins=python
socket = 127.0.0.1:9002
wsgi-file = /thesystem/code/api.py
master = True
processes = 4
threads = 2
daemonize = /thesystem/logs/uwsgi.log
pidfile = /thesystem/uwsgi.pid
uj5u.com熱心網友回復:
很可能你是在/thesystem/code/api.py入口點打開連接.這意味著您的檔案描述符將在worker中繼承,這不適用于sqlalchemy.
在你的ini配置中添加–lazy-apps(lazy-apps = true),在每個worker中加載/thesystem/code/api.py,而不是在master中加載它然后呼叫fork()
uj5u.com熱心網友回復:
這個錯誤我在開發程序中也遇見過,現在已解決。可以看一下我的文章https://blog.csdn.net/liuhuanchao/article/details/103639298
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/128776.html
標籤:其他技術討論專區
上一篇:houdini群集如何讓弓箭插入角色身體(角色有影片)
下一篇:萌新100問
