Thread: Client connection lost; still in the task list
Hello, We've just put into production with our main application which we ported from MSSQLserver to PostgreSQL; We are overall very pleased with PostgreSQL speed and stability are fantastic. We have one user which PC keeps freezing and despite rebooting the computer several times since this morning I can find more than 24 connections for this user when there should be at most 2. So we are experiencing 'too many users connected' errors So my question is what makes PostgreSQL realise that a connection is dead ? when will it drop it and free the connection ? Doing a ps ax I see many connection related to that IP address, can I safely kill the processes which are obviously redundant ? if yes, which signal to send ? (I do not want to kill the postmaster, just the connection). Going forward is there a good way of doing this ? We are running on Centos 4, PostgreSQL 8.3 thanks in advance for your input Didier
"Didier Gasser-Morlay" <didiergm@gmail.com> writes: > So my question is what makes PostgreSQL realise that a connection is > dead ? when will it drop it and free the connection ? It'll drop it when the kernel tells it the connection is dead. Standard TCP timeouts are measured in hours, though. You might be able to get a shorter timeout to be applied by fooling with the "keepalive" parameters, if those can be adjusted on your platform. regards, tom lane
You're right, this morning most connections had been freed. I have seen that the tcp_keepalive is 7200 second, I'll shorten that to see. thanks Didier On Tue, Apr 22, 2008 at 7:29 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > "Didier Gasser-Morlay" <didiergm@gmail.com> writes: > > So my question is what makes PostgreSQL realise that a connection is > > dead ? when will it drop it and free the connection ? > > It'll drop it when the kernel tells it the connection is dead. > Standard TCP timeouts are measured in hours, though. You might > be able to get a shorter timeout to be applied by fooling with > the "keepalive" parameters, if those can be adjusted on your platform. > > regards, tom lane >
Resucing the tcp_keepalive to 900 seconds did help immensely thanks for the advice Tom Didier >You're right, this morning most connections had been freed. > >I have seen that the tcp_keepalive > is 7200 second, I'll shorten that to see. >thanks >Didier On Tue, Apr 22, 2008 at 7:29 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > "Didier Gasser-Morlay" <didiergm@gmail.com> writes: > > So my question is what makes PostgreSQL realise that a connection is > > dead ? when will it drop it and free the connection ? > > It'll drop it when the kernel tells it the connection is dead. > Standard TCP timeouts are measured in hours, though. You might > be able to get a shorter timeout to be applied by fooling with > the "keepalive" parameters, if those can be adjusted on your platform. > > regards, tom lane >