Django python-rq — DatabaseError SSL error: decryp

2019-03-25 05:05发布

I'm using the django-redis and django_rq frameworks to support both redis caching and redis background task processing for my Django application on Heroku. It's worked smoothly in the past, however now I keep getting a DatabaseError SSL error: decryption failed or bad record mac every time one of my jobs get run.

I read that this error occurs commonly with Postgres in the https://devcenter.heroku.com/articles/postgres-logs-errors article, but it hasn't really been giving me anything useful for my python setup.

2条回答
Viruses.
2楼-- · 2019-03-25 05:40

I suspect the cause of the problem, was too many processes(multi) were trying to get to PostGres, it was not able to handle that.

In my case I was using Django with PostGres RDS. I had this fixed by adding 'OPTIONS': {'sslmode': 'disable'} in the database config.

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': ...
        'USER': ....
        'PASSWORD': ...
        'HOST': ....
        'PORT': '5432',
        'OPTIONS': {
           'sslmode': 'disable',
        }
    }

}

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-03-25 05:50

The problem is solved by closing the DB connection at the beginning of each job.

For example,

@job
some_job():
    from django.db import connection
    connection.close()
    some_more_code()
查看更多
登录 后发表回答