Re: issue with host name lookup in PQconnectdb - Mailing list pgsql-general

From Tom Lane
Subject Re: issue with host name lookup in PQconnectdb
Date
Msg-id 19016.1480604424@sss.pgh.pa.us
Whole thread Raw
In response to issue with host name lookup in PQconnectdb  (dharani kumar <dharanikumarsrvn@gmail.com>)
List pgsql-general
dharani kumar <dharanikumarsrvn@gmail.com> writes:
> The problem i am facing is that PQconnectdb is blocking even though i
> specified connect_timeout=10. My observation is below.
> 1. To simulate this issue, i stopped the postgreSQL-x64-9.4 service and
> executed my application.
> 2. host=localhost is used, database present in the same machine.
> 3. I have a service created by NSSM, created out of my application exe.
> 4. My application doesn't blocks, the PQconnectDB fails instantaneously but
> when ran as a service PQconnectDB blocks. No difference in code and
> environment between exe and service.
> 5. The blocking issue in service gets eliminated when i replace host with
> hostaddr=127.0.0.1. I thought maybe DNS lookup was the issue.

AFAIK this is expected behavior: libpq is not able to make its DNS lookups
nonblocking.  The hostaddr option was added specifically so there is a way
to make connections without relying on DNS.

            regards, tom lane


pgsql-general by date:

Previous
From: Melvin Davidson
Date:
Subject: Re: Overwrite pg_catalog?
Next
From: "David G. Johnston"
Date:
Subject: Re: Overwrite pg_catalog?