Socket (fd) to posters server getting closed. (libpq)

Поиск
Список
Период
Сортировка
От Sudheer H R
Тема Socket (fd) to posters server getting closed. (libpq)
Дата
Msg-id B84343DA-1078-444D-B259-A2C7C3CC6242@tekenlight.com
обсуждение исходный текст
Ответы Re: Socket (fd) to posters server getting closed. (libpq)
Список pgsql-bugs
Hi,

I am writing a piece of software to connect to the Postgres database in the asynchronous manner and have used PQconnectStartParams, PQsendPrepare, PQFlush , etc… in conjunction with libev.


The established connection is used for a transaction, and then added to a pool of connections, and then subsequently retrieved from the pool for reuse.

I notice that the retrieved connection has the socket fd closed, which leads to an error o the nature:  could not receive data from server: Bad file descriptor


While the client library (libpq) does not detect the closed socket (unix domain socket) and tries to communicate with the server and throws an error.



Saw this communication trail on the subject https://www.postgresql.org/message-id/12708.1411394055@sss.pgh.pa.us where someone else has faced the same error while coding in python (I am using Lua for this purpose)


I guess it becomes necessary to check for readiness of read and write of the fd returned by PQsocket before continuing to use it again.

My concern is, this is happening unexpectedly and quite soon (after the connection is added to the pool in 1 or 2 seconds)

I would like to know the cause of closure of the connection, if there is any and like to arrest it rather than having to reopen the connection again.

Any feedback regarding this would be appreciated.

Regards,
Sudheer

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Assertion on create index concurrently
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Socket (fd) to posters server getting closed. (libpq)