Thread: strange connection problem.

strange connection problem.

From
"Day, David"
Date:

I have a development site ( FreeBSD 10.1 and Postgres 9.3 )  where I can connect to the database via psql or pgadminIII both locally and remotely.

However, all of the local apps ( 3 different ones )  that would connect to it are failing to  connect.

 

I see no error events in the messages/postgres log files related to bad attempts.

I suspect something with name resolution,

The hosts, hosts.conf and resolv.conf files are set to resolv first via the hosts file

And the hostname and localhost are properly defined there.

 

The site installation did have some initial DNS setup issues.  However this command works fine locally.

“psql –U <role>  -h <hostname> database.

i.e. name resolution works locally fine for psql.

 

The problem does not go away on shutting down and starting up the system ( Virtual Machine )

 

Is there anything on the postgres side that might explain this situation ?

 

Will likely re-install and see if the problem goes away. ( build of the day problem ? )

It is an interesting puzzle at the moment.

 

 

 

Thanks

 

 

Dave

Re: strange connection problem.

From
Yves Dorfsman
Date:
On 2015-10-23 08:29, Day, David wrote:
> I have a development site ( FreeBSD 10.1 and Postgres 9.3 )  where I can
> connect to the database via psql or pgadminIII both locally and remotely.
>
> However, all of the local apps ( 3 different ones )  that would connect to it
> are failing to  connect.

Sounds like your apps are using a different port than the default install. Use
"psql -p xxxx" with the port from the URI configured in your apps.


--
http://yves.zioup.com
gpg: 4096R/32B0F416



Re: strange connection problem.

From
"David G. Johnston"
Date:
On Fri, Oct 23, 2015 at 10:29 AM, Day, David <dday@redcom.com> wrote:

I have a development site ( FreeBSD 10.1 and Postgres 9.3 )  where I can connect to the database via psql or pgadminIII both locally and remotely.

However, all of the local apps ( 3 different ones )  that would connect to it are failing to  connect.


​So how do the methods the local apps use to connect to PostgreSQL differ compared to running psql directly on the same machine?

David J.
 

Re: strange connection problem.

From
Adrian Klaver
Date:
On 10/23/2015 07:29 AM, Day, David wrote:
> I have a development site ( FreeBSD 10.1 and Postgres 9.3 )  where I can
> connect to the database via psql or pgadminIII both locally and remotely.
>
> However, all of the local apps ( 3 different ones )  that would connect
> to it are failing to  connect.
>
> I see no error events in the messages/postgres log files related to bad
> attempts.
>
> I suspect something with name resolution,
>
> The hosts, hosts.conf and resolv.conf files are set to resolv first via
> the hosts file
>
> And the hostname and localhost are properly defined there.
>
> The site installation did have some initial DNS setup issues.  However
> this command works fine locally.
>
> “psql –U <role>  -h <hostname> database.
>
> i.e. name resolution works locally fine for psql.
>
> The problem does not go away on shutting down and starting up the system
> ( Virtual Machine )
>
> Is there anything on the postgres side that might explain this situation ?

What are the connection parameters for the local apps versus the ones
you used above for psql?

In particular the user?

What is in your pg_hba.conf file?

When you say locally are you talking about everything happening in the
VM or between the host machine and the VM or some combination thereof?

What are your logging parameters in postgresql.conf?

>
> Will likely re-install and see if the problem goes away. ( build of the
> day problem ? )
>
> It is an interesting puzzle at the moment.
>
> Thanks
>
> Dave
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: strange connection problem.

From
"Day, David"
Date:

One app is connecting through libpqxx,  the other 2,  glassfish and ejabber chat agent,  I am not certain.

It is only on this one machine where I am having a connection  issue with any of these apps.

I can connect via the identical roles that these apps would be using via the psql command line on this system.

I doubt that all three would have a connection issue on the same day, without some kind of global matter.

 

My pg_hba.conf file on this system is the following.

# "local" is for Unix domain socket connections only

local   all             all                                     trust

# IPv4 local connections:

host    all             all             127.0.0.1/32            trust

# IPv6 local connections:

host    all             all             ::1/128                 trust

# Allow replication connections from localhost, by a user with the

# replication privilege.

host all all 192.168.32.0/19 trust

 

I don’t believe this to be a postgres problem, but you don’t know what you don’t know.

 

 

 

 

From: David G. Johnston [mailto:david.g.johnston@gmail.com]
Sent: Friday, October 23, 2015 10:36 AM
To: Day, David
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] strange connection problem.

 

On Fri, Oct 23, 2015 at 10:29 AM, Day, David <dday@redcom.com> wrote:

I have a development site ( FreeBSD 10.1 and Postgres 9.3 )  where I can connect to the database via psql or pgadminIII both locally and remotely.

However, all of the local apps ( 3 different ones )  that would connect to it are failing to  connect.

 

​So how do the methods the local apps use to connect to PostgreSQL differ compared to running psql directly on the same machine?

 

David J.

 

Re: strange connection problem.

From
Tom Lane
Date:
"Day, David" <dday@redcom.com> writes:
> I have a development site ( FreeBSD 10.1 and Postgres 9.3 )  where I can connect to the database via psql or
pgadminIIIboth locally and remotely. 
> However, all of the local apps ( 3 different ones )  that would connect to it are failing to  connect.

Are those apps trying to use TCP connections, or Unix-socket connections?
If the latter, it might be a discrepancy in where they expect the socket
file to be versus where the postmaster thinks it should be.

            regards, tom lane


Re: strange connection problem.

From
Adrian Klaver
Date:
On 10/23/2015 08:23 AM, Day, David wrote:
> One app is connecting through libpqxx,  the other 2,  glassfish and
> ejabber chat agent,  I am not certain.
>
> It is only on this one machine where I am having a connection  issue
> with any of these apps.
>
> I can connect via the identical roles that these apps would be using via
> the psql command line on this system.
>
> I doubt that all three would have a connection issue on the same day,
> without some kind of global matter.
>
> My pg_hba.conf file on this system is the following.
>
> # "local" is for Unix domain socket connections only
>
> local   all             all                                     trust
>
> # IPv4 local connections:
>
> host    all             all             127.0.0.1/32            trust
>
> # IPv6 local connections:
>
> host    all             all             ::1/128                 trust
>
> # Allow replication connections from localhost, by a user with the
>
> # replication privilege.
>
> host all all 192.168.32.0/19 trust
>
> I don’t believe this to be a postgres problem, but you don’t know what
> you don’t know.
>


Can you launch one or more of the apps from the command line and see if
any errors appear there, that are not bubbling up to the app?

Also, and to answer Toms questions, what are the exact connection
parameters being used in the app(s)?



--
Adrian Klaver
adrian.klaver@aklaver.com


Re: strange connection problem.

From
"Day, David"
Date:
I figured this out and it is not a Postgres issue.
There was a area  of initialization overlooked by the installer on a fresh install
of a development system..

I had to add a little extra debug to see that one key job not
only was not getting attached to the database, it was not even trying.
After seeing that I able to run down the installation flaws.

Thanks very much to all for your suggestions on this matter.


Regards


Dave



-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Friday, October 23, 2015 12:49 PM
To: Day, David
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] strange connection problem.

"Day, David" <dday@redcom.com> writes:
> I have a development site ( FreeBSD 10.1 and Postgres 9.3 )  where I can connect to the database via psql or
pgadminIIIboth locally and remotely. 
> However, all of the local apps ( 3 different ones )  that would connect to it are failing to  connect.

Are those apps trying to use TCP connections, or Unix-socket connections?
If the latter, it might be a discrepancy in where they expect the socket file to be versus where the postmaster thinks
itshould be. 

            regards, tom lane