Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id D3A7262FFE5 for ; Fri, 30 Jul 2010 09:00:25 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 90687-02 for ; Fri, 30 Jul 2010 12:00:17 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from remote.stepsoftware.com.br (step.funcitec.rct-sc.br [189.8.192.142]) by mail.postgresql.org (Postfix) with ESMTP id 2D3E762FA79 for ; Fri, 30 Jul 2010 09:00:16 -0300 (ADT) Received: from SBS.step.local ([fe80::3df9:2e60:f833:73b7]) by SBS.step.local ([fe80::3df9:2e60:f833:73b7%10]) with mapi; Fri, 30 Jul 2010 09:00:09 -0300 From: Kananda To: Scott Marlowe CC: "pgsql-admin@postgresql.org" Date: Fri, 30 Jul 2010 08:58:10 -0300 Subject: RES: [GENERAL] PostgreSQL keepalives help Thread-Topic: [GENERAL] PostgreSQL keepalives help Thread-Index: Acsve6QgsMkg/0Z3Sie6eAgnBM4CJwAYtcrZ Message-ID: <4A704C139DFD804DB74FFB9CC0BE79FC790B5631C5@SBS.step.local> References: <4A704C139DFD804DB74FFB9CC0BE79FC790B5631C3@SBS.step.local>, In-Reply-To: Accept-Language: pt-BR Content-Language: pt-BR X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: pt-BR Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.5 tagged_above=-10 required=5 tests=BAYES_05=-0.5 X-Spam-Level: X-Archive-Number: 201008/14 X-Sequence-Number: 35263 No.. I'm not in linux! OS: Windows 7 (client) / Windows Server 2008 (server= ) Thanks Kananda S Silveira - Desenvolvedora .NET / Analista de Banco de Dados STEP SOFTWARE Tecnologia e Projetos LTDA kananda@stepsoftware.com.br / +55(48)8417-8121 ________________________________________ De: Scott Marlowe [scott.marlowe@gmail.com] Enviado: quinta-feira, 29 de julho de 2010 21:02 Para: Kananda Cc: pgsql-admin@postgresql.org Assunto: Re: [GENERAL] PostgreSQL keepalives help !!! Please do not post to multiple lists. Pick one, see what bites you get, wait, then try another if no one answers. I'm removing all but pgsql-admin from this post !!! On Thu, Jul 29, 2010 at 2:16 PM, Kananda wrot= e: > Hy, > > I have a system working with the client-server structure and PostgreSQL 8= .4. What OS? > My problem is that if a client who is editing a record and lose his > connection to the server,the TCPIP connection is still considered! So, th= e > record stay allocated for the client in my database. > I need the records are free for edit, in few minutes. Therefore I set the > KEEPALIVE configuration in my "postgresql.conf": > > tcp_keepalives_idle =3D 60 # TCP_KEEPIDLE, in seconds; > tcp_keepalives_interval =3D 60 # TCP_KEEPINTVL, in seconds; > tcp_keepalives_count TCP_KEEPCNT =3D 5 #; > > After making these settings and restart the server, the system continues = to > function the same way: Just breaks the connection TCPIP after two hours a= nd > then deallocates the records in PostgreSQL. I need a efficient and safe w= ay > for the PostgreSQL understand that is to break these connections as > configured! I need help, urgent! I'll assume you're on linux, in which case try setting those values with sysctl like so: Edit /etc/sysctl.conf. add these lines at the bottom: net.ipv4.tcp_keepalive_time =3D 300 net.ipv4.tcp_keepalive_probes =3D 2 net.ipv4.tcp_keepalive_intvl =3D 30 Then run "sudo sysctl -p" See if the changes took effect: sysctl -a|grep keepa