Re: Puzzling situation with threads and psycopg2 on RDS

Поиск
Список
Период
Сортировка
От Daniele Varrazzo
Тема Re: Puzzling situation with threads and psycopg2 on RDS
Дата
Msg-id CA+mi_8aX4FsE6=HWF08tf579G8Wgg9cQOtN2BkmtTehyxAb5FA@mail.gmail.com
обсуждение исходный текст
Ответ на Puzzling situation with threads and psycopg2 on RDS  (Stefan Knecht <knecht.stefan@gmail.com>)
Ответы Re: Puzzling situation with threads and psycopg2 on RDS
Список psycopg
Hi Stefan,

On Mon, 17 Oct 2022 at 12:25, Stefan Knecht <knecht.stefan@gmail.com> wrote:
>
> Hello
>
> I have this situation now, that I can't wrap my head around and I'm hoping someone can shed some light onto what is
goingon, before I spend hours trying to reproduce this by taking the code apart into a test case.
 
>
> A few facts:
>
> - I've got a piece of code split into several classes.
> - It initializes a dynamic number of threads. For the sake of this topic, I'll stick to just 2 threads to
illustrate.
> - Each thread creates its own database connection (psycopg2.connect()) when it's started
> - Each thread, for each task it does, prints out its own name and the PID of the database session.
...

> Perhaps you can already see the problem. One thread randomly disconnects.

I understand this happens on RDS. Does it happen on normal Postgres
too, from a normal process (not some serverless thing?)

Are there processes/forks involved? Which version of psycopg are you
using? Some old one have problems with closing connections in
multiprocess environments. That was fixed in psycopg 2.8 (#829).

Cheers

-- Daniele



В списке psycopg по дате отправления:

Предыдущее
От: Stefan Knecht
Дата:
Сообщение: Puzzling situation with threads and psycopg2 on RDS
Следующее
От: Stefan Knecht
Дата:
Сообщение: Re: Puzzling situation with threads and psycopg2 on RDS