Hi,

I am having some issues regarding the postgres db connection being dropped periodically when using the docker-compose setup of the redash. It seems that is somehow related with the psycopg2 adapter.

Versions:
redash version: 3.0.0.b3147
postgres db version: 9.4-alpine

Log Error:
DEBUG: 08003: unexpected EOF on client connection [PID:1][ERROR][MainProcess] Task redash.tasks.execute_query[c938876b-26f6-4e77-9623-440091e59f8e] raised unexpected: OperationalError('(psycopg2.OperationalError) server closed the connection unexpectedly\n\tThis probably means the server terminated abnormally\n\tbefore or while processing the request.\n',)

Best,
Jorge

I just tried to remove the existed containers and setup new ones and succeed without problem.

So you might want to provide more information to describe you situation. Such as

  • Which step do you mean by ‘docker-compose setup’. (I suppose you’re trying the Docker Compose here?
  • What’s your docker-compose.production.yml like?

My setting’s difference with the original file is as follow

--- a/docker-compose.production.yml
+++ b/docker-compose.production.yml
@@ -18,9 +18,10 @@ services:
       PYTHONUNBUFFERED: 0
       REDASH_LOG_LEVEL: "INFO"
       REDASH_REDIS_URL: "redis://redis:6379/0"
-      REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres"
+      REDASH_DATABASE_URL: "postgresql://redash:redash@postgres/redash"
       REDASH_COOKIE_SECRET: veryverysecret
       REDASH_WEB_WORKERS: 4
+      REDASH_DATE_FORMAT: YYYY/MM/DD
     restart: always
   worker:
     image: redash/redash:latest
@@ -29,24 +30,30 @@ services:
       PYTHONUNBUFFERED: 0
       REDASH_LOG_LEVEL: "INFO"
       REDASH_REDIS_URL: "redis://redis:6379/0"
-      REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres"
+      REDASH_DATABASE_URL: "postgresql://redash:redash@postgres/redash"
       QUEUES: "queries,scheduled_queries,celery"
       WORKERS_COUNT: 2
+      REDASH_DATE_FORMAT: YYYY/MM/DD
     restart: always
   redis:
     image: redis:3.0-alpine
     restart: always
   postgres:
     image: postgres:9.5.6-alpine
-    # volumes:
-    #   - /opt/postgres-data:/var/lib/postgresql/data
+    environment:
+      POSTGRES_USER: "redash"
+      POSTGRES_PASSWORD: "redash"
+      POSTGRES_DB: "redash"
+    volumes:
+      - /Users/MYACCOUNT/opt/postgres-data:/var/lib/postgresql/data

Since the docker-compose file we use is a custom one with several confidential information I can’t post it here. We have some memory and cpu limitations applied for each one of the containers (2G for the redash server/workers 512M for the postgres/redis and 128M for the nginx), but it doesn’t seem to be the issue. The major diferences when comparing with the one provided by te redash repo are only the postgres and redash docker image versions.

The error described on the original post does’t happen very often (~1 or 2 times/day), usually after a Exception when some API endpoints (ERROR in app: Exception on /api/queries/1 [GET] for example).

On the user point of view, seems that it can cause some dashboard calls using queries to fail (500 HTTP errors).

Hmm, in that case, sorry that I can’t be of help.
If only we know how to reproduce the problem.

Hi,

I’m not entirely sure if this is an error of connection with the metadata database or with the one you’re querying. Is the database you’re querying is Postgres or Redshift too?

Also, how did you deploy your Docker containers?