SSL SYSCALL error: EOF detected #8348
Unanswered
csangonzo
asked this question in
Usage Questions
Replies: 1 comment 3 replies
-
hi, there behaviour you are experiencing here seems environment dependant, not something really connected to sqlalchemy. since you mentioned that the number of worker does have an impact, maybe you need to increase the total number of allowed connection by postgresql? also strange that you are using psycopg2 with fastapi that's async, but I don't think this has any influence here |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey guys!
A little background on what we're working on and how did we get here.
We've built a server side application (FastAPI) to handle data syncronization between a postgres database and an internal API. We're running multiple workers simultaneously with
rq-scheduler
- each environment has it's own worker and it's own queue, most notably there's a job that runs every hour to keep the data up to date.Now for the tricky part: we have one database, let's call it
X
, where we store our metadata for the syncronization process (environment ids, external ids etc.) and we have some logs about it here in async
schema. In another schema there's our source data that needs to be syncronized to this other service - this data is originally in another database, let's call itY
, which is accessed with postgres fdw (foreign data wrapper) which points to a read-only replica of the original live database Y.Lately we ran into some issues regarding a query, where we got the following error:
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) SSL SYSCALL error: EOF detected
.The query itself runs in under 3 minutes when I use it directly (in DBeaver) without a problem using the fdw tables. In the original source it runs almost instantly. This bottleneck is caused by the fdw and I'm okay with it as far as it finishes. When this same query runs using sqlalchemy it won't finish now, it starts off and after ~20 minutes or so it raises the eof error.
One strange thing about it: lately we reached 10+ simultaneous workers and we don't have this error if I keep the workers under 10. (such a magical number)
One problem that might have an affect is that each worker has it's own sqlalchemy engine:
Could this be the couse of this problem?
I tried using the
pool_timeout
,max_overflow
andpool_size
options as well, but they didn't help.Where should I look for this?
What we're using:
python: 3.8
fastapi: 0.68.1
SQLAlchemy: 1.4.22
rq: 1.9.0
rq-scheduler: 0.11.0
psycopg2-binary: 2.9.1
UPDATE:
The doc says:
Beta Was this translation helpful? Give feedback.
All reactions