pgsync: SSL SYSCALL error

PGSync version: 1.1.25 Postgres version: 9.6.18 Elasticsearch version:

Redis version:

Python version:

Problem Description: After several minutes of polling the DB pgsync gives this error. I tried setting the poll_timeout env var in my docker-compose.yml:

- POLL_TIMEOUT=5

Maybe there should be some retry code added? I also noticed the connection is not retried if the database is disconnected for a bit.

Error Message (if any):

pgsync_1         | Polling db mydb: 0 cache items
pgsync_1         | Exception in thread Thread-8:
pgsync_1         | Traceback (most recent call last):
pgsync_1         |   File "/usr/local/lib/python3.7/threading.py", line 926, in _bootstrap_inner
pgsync_1         |     self.run()
pgsync_1         |   File "/usr/local/lib/python3.7/threading.py", line 870, in run
pgsync_1         |     self._target(*self._args, **self._kwargs)
pgsync_1         |   File "/usr/local/lib/python3.7/site-packages/pgsync/sync.py", line 816, in poll_db
pgsync_1         |     conn.poll()
pgsync_1         | psycopg2.OperationalError: SSL SYSCALL error: EOF detected
pgsync_1         | 
pgsync_1         | 
pgsync_1         | 2021-02-01 17:26:19.695:ERROR:sqlalchemy.pool.impl.QueuePool: Exception during reset or similar
pgsync_1         | Traceback (most recent call last):
pgsync_1         |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 697, in _finalize_fairy
pgsync_1         |     fairy._reset(pool)
pgsync_1         |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 893, in _reset
pgsync_1         |     pool._dialect.do_rollback(self)
pgsync_1         |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 543, in do_rollback
pgsync_1         |     dbapi_connection.rollback()
pgsync_1         | psycopg2.InterfaceError: connection already closed
pgsync_1         | 2021-02-01 17:51:47.246:DEBUG:pgsync.sync: Truncating replication slot: mydb_amenities
pgsync_1         | 2021-02-01 17:51:47.250:ERROR:pgsync.base: Exception (psycopg2.OperationalError) SSL SYSCALL error: EOF detected


About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (9 by maintainers)

Commits related to this issue

Most upvoted comments

that’s amazing! let me know if that resolves it.

I am still doing some research on the cause of this.

You are right pgsync should exit on an operational error. I have pushed some changes to master to address this

I’m afraid PGSync will not attempt to re-establish a connection. This needs to happen at a different layer. You can look into pgbouncer for this. I have used it in the past and it is very robust. https://www.pgbouncer.org/

PGSync will ensure that the data is transactionally consistent. So even if connections are dropped and you restart, you will not lose data.