Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 7A03CB62BA1 for ; Fri, 3 Jun 2011 10:04:09 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 68588-01 for ; Fri, 3 Jun 2011 13:04:02 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from Amber.meep.pl (unknown [193.23.174.18]) by mail.postgresql.org (Postfix) with ESMTP id 36566B62B99 for ; Fri, 3 Jun 2011 10:04:00 -0300 (ADT) Received: from mike by Amber.meep.pl with local (Exim 4.76) (envelope-from ) id 1QSU2f-0002b2-7L for pgsql-general@postgresql.org; Fri, 03 Jun 2011 15:03:57 +0200 Date: Fri, 3 Jun 2011 15:03:57 +0200 From: Michal Politowski To: pgsql-general@postgresql.org Subject: Re: Mixed up protocol packets in server response? Message-ID: <20110603130357.GA7961@meep.pl> References: <20110601130649.GA21333@meep.pl> <4DE6DE56.8030008@postnewspapers.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <4DE6DE56.8030008@postnewspapers.com.au> X-PGP: 1024D/EDBBB56F; A690 41A9 6DDE 7496 6A72 C51B 7DEE 64EB EDBB B56F; 2006-04-21 -- 2009-08-12 User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.342 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_BRBL_LASTEXT=1.449, RDNS_NONE=0.793 X-Spam-Level: X-Archive-Number: 201106/65 X-Sequence-Number: 176498 On Thu, 2 Jun 2011 08:50:30 +0800, Craig Ringer wrote: > On 1/06/2011 9:06 PM, Michal Politowski wrote: >=20 > >What may be the cause of this weird problem? Is it some known or unknown= bug in > >8.3.4 or is the application/Java side more suspected? >=20 > It'd be really helpful if you could collect and examine a trace of > the client/server communication using WireShark. That way you can > confirm whether it is (as Tom suspects) the client side mangling its > buffers, or whether the server really did send the nonsensical > sequence. Actually my own money is with Tom's. It's very hard to believe Postgres would do something like this, unless it were some obvious and long fixed bu= g in 8.3.4. Still, trying to trace the communication makes sense, if I can convince the owners of the system to let me do it. Unfortunately this is an "one in a million of successful queries" (actually two in much more than a = million) problem. And the next run of the application seems not to have hit it, yet. Thinking aloud: If this is, as it is to be suspected, an application-side p= roblem, there is at first sight not much space in the application where it could hi= de. The data is mixed up in a driver buffer, two method calls from the standard library socket code. There is the VisibleBufferedInputStream there. Could it do something like this? Maybe if the connection was erroneously used from two = threads concurrently? The connections are pooled via commons-dbcp BasicDataSource and queries are executed via Spring JdbcTemplate within Spring-configured transaction. No passing connections by hand anywhere, everything should be nicely thread-bound. Still, if not here, where could it go wrong? --=20 Micha=B3 Politowski Talking has been known to lead to communication if practiced carelessly.