On Friday October 10 2003 4:46, Ed L. wrote:
> I have libpq client program that repeatedly connects to a DB, queries,
> and then disconnects. After a seemingly random number of such successful
> sessions (sometimes 30, sometimes hundreds), the backend mysteriously
> exits after the client calls PQsetdbLogin(), and the client hangs. Any
> clues? Details below...
>
> Client: C program linked with 7.2.1 libpq on HP-UX B.11.00 E 9000/803.
> Server: PostgreSQL 7.3.2 on i686-pc-linux-gnu, compiled by GCC 2.96.
Still looking for clues as to the cause of this repeatable connection
failure. Passing an explicit connection timeout to PQconnectdb() escapes
from any long hangs, but the hanging is still an issue I'd like to
understand. Attached is a small C program that reliably reproduces this
problem on the setup above. I added an explicit timeout to PQconnectdb()
to wait only 30 seconds. I'm curious to know if anyone can easily repeat
the problem (careful, it will generate a bit of traffic, cpu load, and run
forever). My last example run showed 17 timeouts seemingly randomly
dispersed among 5000 consecutive connection attempts.
The server has plenty of available memory on a dual processor machine
running Linux 2.4.18-3smp. Tried to catch snapshot data from netstat on
Recv-Q and Send-Q sizes on the server during a hang... that's a little iffy
with the timing of grepping netstat output, but seems like the server's
Recv-Q's were always zero and the Send-Q's were occasional in the tens
(bytes?).
TIA for any help.