From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | libpq connection timeout mismanagement |
Date: | 2018-08-09 15:23:04 |
Message-ID: | 5735.1533828184@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
The patch that taught libpq about allowing multiple target hosts
modified connectDBComplete() with the intent of making the
connect_timeout (if specified) apply per-host, not to the complete
connection attempt. It did not do a very good job though, because
the timeout only gets reset when connectDBComplete() itself detects
a timeout. If PQconnectPoll advances to a new host due to some
other cause, the previous host's timeout continues to run, possibly
causing a premature timeout failure for the new one.
Another thing that I find pretty strange is that it is coded so that,
in event of a timeout detection by connectDBComplete, we give up on the
current connhost entry and advance to the next host, ignoring any
additional addresses we might have for the current hostname. This seems
at best poorly thought through. There's no good reason for libpq to
assume that all the addresses returned by DNS point at the same machine,
or share the same network failure points in between.
Attached is an attempt to improve this. I'll park it in the Sept fest.
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
libpq-connect-timeout-1.patch | text/x-diff | 2.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Bossart, Nathan | 2018-08-09 15:27:04 | Re: Improve behavior of concurrent TRUNCATE |
Previous Message | Marina Polyakova | 2018-08-09 15:17:22 | Re: [HACKERS] WIP Patch: Pgbench Serialization and deadlock errors |