Thursday, May 5, 2016

celery, flask sqlalchemy: DatabaseError: (DatabaseError) SSL error: decryption failed or bad record mac

Leave a Comment

Hi I have a setup where I'm using Celery Flask SqlAlchemy and I am intermittently getting this error:

 (psycopg2.DatabaseError) SSL error: decryption failed or bad record mac 

I followed this post:

Celery + SQLAlchemy : DatabaseError: (DatabaseError) SSL error: decryption failed or bad record mac

and also a few more and added a prerun and postrun methods:

@task_postrun.connect def close_session(*args, **kwargs):     # Flask SQLAlchemy will automatically create new sessions for you from      # a scoped session factory, given that we are maintaining the same app     # context, this ensures tasks have a fresh session (e.g. session errors      # won't propagate across tasks)     d.session.remove()  @task_prerun.connect def on_task_init(*args, **kwargs):     d.engine.dispose() 

But I'm still seeing this error. Anyone solved this?

Note that I'm running this on AWS (with two servers accessing same database). Database itself is hosted on it's own server (not RDS). I believe the total celery background tasks running are 6 (2+4). Flask frontend is running using gunicorn.

0 Answers

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment