Received: from mailhost1.dircon.co.uk (mailhost1.dircon.co.uk [194.112.32.65]) by hub.org (8.9.3/8.9.3) with ESMTP id OAA76215 for ; Sat, 2 Oct 1999 14:07:51 -0400 (EDT) (envelope-from dirk-n@dircon.co.uk) Received: from dircon.co.uk (th-en135-004.pool.dircon.co.uk [194.112.54.4]) by mailhost1.dircon.co.uk (8.9.1/8.8.7) with ESMTP id TAA14395 for ; Sat, 2 Oct 1999 19:07:49 +0100 (BST) Sender: dirk@mailhost1.dircon.co.uk Message-ID: <37F64B68.60868E33@dircon.co.uk> Date: Sat, 02 Oct 1999 19:14:00 +0100 From: Dirk Niggemann X-Mailer: Mozilla 4.5 [en] (X11; I; Linux 2.0.36 i586) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-interfaces@postgresql.org Subject: timeouts in libpq- can libpq requests block forever/a very long time? Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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