Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 55C0F1C361C1 for ; Fri, 29 Jun 2012 02:17:24 -0300 (ADT) Received: from nm15.bullet.mail.bf1.yahoo.com ([98.139.212.174]) by makus.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1SkTa6-0005oX-F4 for pgsql-jdbc@postgresql.org; Fri, 29 Jun 2012 05:17:24 +0000 Received: from [98.139.215.142] by nm15.bullet.mail.bf1.yahoo.com with NNFMP; 29 Jun 2012 05:17:09 -0000 Received: from [98.139.215.249] by tm13.bullet.mail.bf1.yahoo.com with NNFMP; 29 Jun 2012 05:17:09 -0000 Received: from [127.0.0.1] by omp1062.mail.bf1.yahoo.com with NNFMP; 29 Jun 2012 05:17:09 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 173621.9090.bm@omp1062.mail.bf1.yahoo.com Received: (qmail 28936 invoked by uid 60001); 29 Jun 2012 05:17:09 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1340947029; bh=eh9oX0NRSZdMmUCqPnZG2/iCpIQGvxKqVFWHhpsWCcg=; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type; b=SlwA4l0sIzPszP5LoEL+Cm11i2iaQf219rFtt1RjSPXupld1LHz3IxphdrwsKHGxgOTX6BWnEKDswUWYMbFdB4hQwYx04yYNp4sHw83EaDJ9HhWAY6Vs1qNuKFvJpCCo2FIOUgn+HpyyHxbd5Y3WpKnZrL1tiST8ht1NNCpnHvo= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type; b=bE46rFBoqnROgwOlcuXwDz5KflzTC8XbHrgb6ZswQk9Yxm2jdJZZqepMM0lZrsLMwPSJFK8G0yZdA2OANiEroQAAke1ZAnwEigrZnlR207Kt9aMCuDL4+no2LyX1q44cvCqjHgEfXw0vOUmA7I/xZItdwQuitBjwzKhsLIAAHsI=; X-YMail-OSG: 79dTiwMVM1mNAh6DSiY9wWHNpMn6tCHTyP5JPUVb899YnOf qrxGnsxp7vWakJNtdlYl_.Dg_p.xoRx5LlnfHybfRAsLbv7qgdwRfZLv5a0g aAY.aJlAfkClgmkvbi4dLh6mvKTBGQVo.r5yY4LeNbXsUgcS5O0iAQm3KlsQ j28AUyJYhSa_icOB4xbW1_bj9YnkWHEeQ.X7.xPwdLJGoMVfO46cXNDjpEPD 2en6OKpsg2msiY1YD_ZAKdqODNU7kQS_RS3Uj4PziEM1zaJ.FFbN67vvd5ly kTkitjdEeyoVdMXCmUjYdKZYJDy4x0qYwaAqZnqvs8z1nGB.B2MFLyEpatY5 1W3OmHNXsn87NhEcx7Xhck5Xo77qEIhuGK3xf1mzVaFQ9RDcuw2CFt20IPr. Ix1RKMXYJ4MVJXu7npzHZ3IHC3hux9Nz4ADvSaV1T3HcXeh.iujuJ_F1tT5H 48t5KVDKIyCw_Is73qAHmTnYGVyek90IHQsE3JxH_NRC8alezUjg- Received: from [24.189.13.169] by web161406.mail.bf1.yahoo.com via HTTP; Thu, 28 Jun 2012 22:17:08 PDT X-Mailer: YahooMailWebService/0.8.118.349524 References: <1340835352.64379.YahooMailNeo@web161405.mail.bf1.yahoo.com> <1340900124.55466.YahooMailNeo@web161403.mail.bf1.yahoo.com> <4FED1DB9.50602@ringerc.id.au> Message-ID: <1340947028.19372.YahooMailNeo@web161406.mail.bf1.yahoo.com> Date: Thu, 28 Jun 2012 22:17:08 -0700 (PDT) From: Kiran Kulkarni Reply-To: Kiran Kulkarni Subject: Re: org.postgresql.util.PSQLException: An I/O error occured while sending to the backend To: Craig Ringer Cc: Dave Cramer , "pgsql-jdbc@postgresql.org" In-Reply-To: <4FED1DB9.50602@ringerc.id.au> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="122454116-1493424355-1340947028=:19372" X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201206/104 X-Sequence-Number: 23098 --122454116-1493424355-1340947028=:19372 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Craig, David,=0A=0AThank you very much for your detailed=A0explanation.=A0= =0A=0ARegards,=0AKiran Kulkarni=0A=0A=0A________________________________=0A= From: Craig Ringer =0ATo: Kiran Kulkarni =0ACc: Dave Cramer ; "pgsql-jdbc@postgr= esql.org" =0ASent: Thursday, June 28, 2012 11:1= 5 PM=0ASubject: Re: [JDBC] org.postgresql.util.PSQLException: An I/O error = occured while sending to the backend=0A =0A=0AOn 06/29/2012 12:15 AM, Kiran= Kulkarni wrote:=0A=0AHello David,=0A>We are using postgres 9.0 and JDBC dr= iver is=A0postgresql-8.4-701.jdbc3.jar.=0ATry to use a JDBC driver at least= as new, if not newer than, the=0A server. The client(s) should always b= e the same release as or newer=0A than the server. The same goes for psq= l, libpq, etc.=0A=0A=0AOur app server & DB, both are running on Linux and t= here is a firewall between app server and DB.=0ATharrr's yer problem.=0A=0A= Does the firewall do NAT or stateful connection tracking? If so, you must u= se keepalives to avoid connection drops if your connections are idle for lo= ng. If you don't know, then your firewall probably does do connection track= ing and thus you must use keepalives.=0A=0AIf you're on a Java EE applicati= on server you can get the server to=0A send a dummy connection check sta= tement like "SELECT 1" every now=0A and then instead of using OS level k= eepalives. I'd prefer an OS=0A level keepalive, though, as unlike connec= tion check statements they=0A don't fill the logs with noise.=0A=0A=0ACa= n upgrading the driver to higher version fix this problem?=0AProbably not i= f there's a firewall involved.=0A=0A=0A>=0A>I have seen similar posts on th= e web. Most tell either to reconnect or to try TCP Keep alive.=0A>For my ca= se, hibernate is managing my connections and I would expect hibernate to de= al with such scenarios.=0AIt doesn't and it can't.=0A=0AIf you configure yo= ur connection pool to verify/check connections=0A you'll reduce the freq= uency with which this happens, but not=0A eliminate it. Your app MUST ha= ndle connection and transaction=0A failures if it wants to be robust. It= 's a pain, but necessary.=0A=0A=0ABut since it is not dealing with such iss= ues I would be more comfortable configuring tcp keep alive rather than medd= ling hibernate managed connections.=0A>=0A>=0A>=0A>Do you know any configur= ation in hibernate which takes care of such issues? Or else pls give me the= steps to configure tcp keep alive.=0A>=0AHibernate cannot do everything fo= r you. If the database connection is lost partway through a transaction the= n YOU must reissue the work. It'd be nice if Hibernate could handle the rec= onnect-and-retry logic for you, but at the moment it can't - and in fact it= even mangles your entity objects when a transaction fails.=0A=0AI wrote a = post on another thread about this a day or two ago, but=0A accidentally = forgot to CC the list. I've re-posted it with subject=0A "Re: [JDBC] org= .postgresql.util.PSQLException: An I/O error occured=0A while sending to= the backend" and it should appear in the archives=0A as=0A =0A ht= tp://archives.postgresql.org/message-id/4FED1C55.4050507@ringerc.id.au=0A = when the archives are next updated. =0A=0A--=0ACraig Ringer --122454116-1493424355-1340947028=:19372 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
Craig, David,

Thank you very much for your d= etailed explanation. 
=

Regards,
Kiran Kulkarni

From: Craig Ringer <ringerc@ringerc.id.au>
To: Kiran Kulkarni <kkiran_kulkarni@yahoo.com>=
Cc: Dave Cramer <p= g@fastcrypt.com>; "pgsql-jdbc@postgresql.org" <pgsql-jdbc@postgresql.= org>
Sent: Thursda= y, June 28, 2012 11:15 PM
Subject= : Re: [JDBC] org.postgresql.util.PSQLException: An I/O error occ= ured while sending to the backend

=0A
=0A =0A=0A =0A =0A
=0A
On 06/29/2012 12:15 AM, Kiran Kulkarni=0A wrote:
=0A=
=0A
=0A =0A
=0A =
Hello David,
=0A
We are using postgres 9.0 and JDBC= driver=0A is postgresql-8.4-701.jdbc3.jar.
=0A =0A
=0A
=0A Try to use a JDBC driver at least = as new, if not newer than, the=0A server. The client(s) should always be= the same release as or newer=0A than the server. The same goes for psql= , libpq, etc.
=0A
=0A
=0A
= =0A
Our app server & DB, both are running on Linux and=0A = there is a firewall between app server and DB.
=0A
= =0A
=0A Tharrr's yer problem.
=0A
=0A Does = the firewall do NAT or stateful connection tracking? If so, you=0A mu= st use keepalives to avoid connection drops if your=0A connections a= re idle for long. If you don't know, then your firewall=0A probably does= do connection tracking and thus you must use=0A keepalives.
=0A <= br>=0A If you're on a Java EE application server you can get the server = to=0A send a dummy connection check statement like "SELECT 1" every now= =0A and then instead of using OS level keepalives. I'd prefer an OS=0A = level keepalive, though, as unlike connection check statements they=0A = don't fill the logs with noise.
=0A
=0A
=0A
=0A
Can upgrading the driver to higher versi= on fix this=0A problem?
=0A
=0A
= =0A
=0A Probably not if there's a firewall involved.
=0A =0A
=0A

=0A
= =0A
I have seen similar posts on the web. Most tell either to= =0A reconnect or to try TCP Keep alive.
=0A
For m= y case, hibernate is managing my connections and I=0A would expect= hibernate to deal with such scenarios.
=0A
=0A =0A It doesn't and it can't.
=0A
=0A If you configure = your connection pool to verify/check connections=0A you'll reduce the fr= equency with which this happens, but not=0A eliminate it. Your app MUST = handle connection and transaction=0A failures if it wants to be robust. = It's a pain, but necessary.
=0A
=0A
= =0A
=0A
But since it is not dealing with such issues= I would be=0A more comfortable configuring tcp keep alive rather = than=0A meddling hibernate managed connections.
=0A =0A

=0A
=0A
Do you know any conf= iguration in hibernate which takes care=0A of such issues? Or else= pls give me the steps to configure tcp=0A keep alive.
=0A =
=0A
=0A
=0A Hibernate cannot do ever= ything for you. If the database connection=0A is lost partway through a = transaction then YOU must reissue the=0A work. It'd be nice if Hibernate= could handle the reconnect-and-retry=0A logic for you, but at the momen= t it can't - and in fact it even=0A mangles your entity objects when a t= ransaction fails.
=0A
=0A I wrote a post on another thread abo= ut this a day or two ago, but=0A accidentally forgot to CC the list. I'v= e re-posted it with subject=0A "Re: [JDBC] org.postgresql.util.PSQLExcep= tion: An I/O error occured=0A while sending to the backend" and it shoul= d appear in the archives=0A as=0A =0A http://archives.postgresql.o= rg/message-id/4FED1C55.4050507@ringerc.id.au=0A when the archives are ne= xt updated.
=0A
=0A --
=0A Craig Ringer
=0A
= =0A=0A


--122454116-1493424355-1340947028=:19372--