timeouts in libpq- can libpq requests block forever/a very long time?

From: Dirk Niggemann <dirk-n(at)dircon(dot)co(dot)uk>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: timeouts in libpq- can libpq requests block forever/a very long time?
Date: 1999-10-02 18:14:00
Message-ID: 37F64B68.60868E33@dircon.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Hi,
looking at the source for libpq- it looks like any
requests using pqWait could block for a potentially (very)
long time (e.g 15mins default TCP/ip timeout). This includes
some requests using the asynchronous interface, particularly
PQFlush will still block indefinitely (whereby indefinitely refers to
"a period of time that makes the user think their app has hung"), and
PQSendQuery will potentially block during the send.)

Would there be any problems with changing pqWait so it uses a timeout?
I would treat this timeout as equivalent to the socket having been
closed
unexpectedly- i.e. I would close the socket myself and then do the usual
handling for an unexpectly closed socket, with the potential to return a
different error...
I would also like to add a timeout for the connect operation on the
socket-
on a sufficiently frazzled WAN this could block for a long time-
how many system variants don't support setting O_NDELAY/O_NONBLOCK
_before_
doing the connect (I know Linux and Solaris do, as for winsock, I
couldn't
even guess...)
Is someone else already doing this work?

Dirk

Browse pgsql-interfaces by date

  From Date Subject
Next Message Tom Lane 1999-10-02 18:43:22 Re: [INTERFACES] timeouts in libpq- can libpq requests block forever/a very long time?
Previous Message Lamar Owen 1999-10-02 17:48:44 Re: [INTERFACES] PL_na undeclared