我正在try 使用uWSGI+Nginx设置一个应用程序Web服务器,它使用SQLAlchemy运行一个Flask应用程序,以与Postgres数据库通信.
当我向Web服务器发出请求时,每隔一次响应都会出现500个错误.
错误是:
Traceback (most recent call last):
File "/var/env/argos/lib/python3.3/site-packages/sqlalchemy/engine/base.py", line 867, in _execute_context
context)
File "/var/env/argos/lib/python3.3/site-packages/sqlalchemy/engine/default.py", line 388, in do_execute
cursor.execute(statement, parameters)
psycopg2.OperationalError: SSL error: decryption failed or bad record mac
The above exception was the direct cause of the following exception:
sqlalchemy.exc.OperationalError: (OperationalError) SSL error: decryption failed or bad record mac
该错误由一个简单的Flask-SQLAlchemy
方法触发:
result = models.Event.query.get(id)
uwsgi
由supervisor
管理,supervisor
有一个配置:
[program:my_app]
command=/usr/bin/uwsgi --ini /etc/uwsgi/apps-enabled/myapp.ini --catch-exceptions
directory=/path/to/my/app
stopsignal=QUIT
autostart=true
autorestart=true
uwsgi
的配置如下所示:
[uwsgi]
socket = /tmp/my_app.sock
logto = /var/log/my_app.log
plugins = python3
virtualenv = /path/to/my/venv
pythonpath = /path/to/my/app
wsgi-file = /path/to/my/app/application.py
callable = app
max-requests = 1000
chmod-socket = 666
chown-socket = www-data:www-data
master = true
processes = 2
no-orphans = true
log-date = true
uid = www-data
gid = www-data
我能得到的最远结果是,这与uwsgi的Forking 有关.但除此之外,我不清楚需要做什么.