Re: connection failures on forked processes

Поиск
Список
Период
Сортировка
От Justin Pryzby
Тема Re: connection failures on forked processes
Дата
Msg-id 20220612145659.GD29853@telsasoft.com
обсуждение исходный текст
Ответ на connection failures on forked processes  (Jim Popovitch <jim.popovitch@replatformtech.com>)
Список pgsql-hackers
On Sun, Jun 12, 2022 at 10:05:59AM -0400, Jim Popovitch wrote:
> We are seeing connection failures when using "sslmode=require" on forked
> connections.  Attached is example code that makes 2 passes. The first pass
> uses "sslmode=disable" and the second uses "sslmode=require".  The first
> pass completes successfully, but the second pass fails.  I'm looking for
> insight as to why this might be happening.

The child's connection works fine, but the grandchild's connection doesn't.

The most obvious reason is that the first child exits which tears down the SSL
connection in a way that doesn't allow sending more data on it (maybe as a
deliberate security measure).  

You'll see the same failure in both cases if you PQfinish() after PQclear().

> Note: we are very aware of the dev notes about forking, however know that
> we are not sharing the forked connection, we simply open the connection in
> the parent thread and then pass that to the child thread to use.

In case there is any doubt: processes are not threads.
(Also, I don't think the phrase "parent thread" is more misleading than
accurate, although I'm sure some people use it.)

-- 
Justin



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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: Subscription tests vs log_error_verbosity
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Quick question regarding HeapTupleHeaderData.t_ctid