Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 828851337B49 for ; Sat, 19 Feb 2011 06:47:21 -0400 (AST) 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 15974-04 for ; Sat, 19 Feb 2011 10:47:13 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.softperience.eu (static-ip-217-118-26-141.inaddr.intergenia.de [217.118.26.141]) by mail.postgresql.org (Postfix) with ESMTP id C20C51337B43 for ; Sat, 19 Feb 2011 06:47:11 -0400 (AST) Received: from radek.localnet (87-204-194-135.dg-net.pl [87.204.194.135]) by mail.softperience.eu (Postfix) with ESMTPA id BB6E9C000B1; Sat, 19 Feb 2011 11:47:17 +0100 (CET) From: =?utf-8?q?Rados=C5=82aw_Smogura?= To: pgsql-jdbc@postgresql.org Subject: Re: PGXAConnection and autocommit problem Date: Sat, 19 Feb 2011 11:47:24 +0100 User-Agent: KMail/1.13.5 (Linux/2.6.36-gentoo-r5; KDE/4.4.5; x86_64; ; ) Cc: "Maurin, Marion" , Achilleas Mantzios References: <201102101145.10201.achill@matrix.gatewaynet.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <201102191147.24592.rsmogura@softperience.eu> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201102/125 X-Sequence-Number: 21523 "Maurin, Marion" Thursday 17 February 2011 14:02= :28 > Hi, >=20 > I checked the two links you proposed. > Concerning this one: > http://archives.postgresql.org/message-id/201003021629.07368.achill%40matr > ix.gatewaynet.com The problem of autocommit described in the conclusion > seemed to be caused by the reuse of a connexion by different transactions. > So I tried to run my tests while assuring that the connection used was > really a new one (checked the ids in debug mode), and nothing changed for > me. Thus I don't think it is the same problem I'm facing. I also followed > the advice of activating the debug mode for postgresql logs, and I got > that: ----- > 18:15:22.623 (1) simple execute, > handler=3Dorg.postgresql.jdbc2.AbstractJdbc2Statement$StatementResultHand= ler > @d458ab, maxRows=3D0, fetchSize=3D0, flags=3D17 18:15:22.623 (1) FE=3D> > Parse(stmt=3Dnull,query=3D" UPDATE ACTUALITE SET TITRE =3D $1, CONTE= NU =3D > $2, IMPORTANTE =3D $3, ETAT_ESPACE_DISCUSSION_ID =3D $4, =20 > MODERATION_ID =3D $5, AUTEUR_MAJ =3D $6, ESPACE_DISCUSSION =3D = $7, =20 > DATE_PUBLICATION =3D $8, DATE_EXPIRATION =3D $9, DATE_MAJ = =3D $10, > IMAGE_POSITION =3D $11, IMAGE_DIMENSION =3D $12, =20 > TYPE_ACTUALITE_ID =3D $13 WHERE ACTUALITE_ID =3D > $14",oids=3D{1043,1043,16,0,0,20,16,0,0,0,20,20,20,20}) 18:15:22.623 (1)= =20 > FE=3D> Bind(stmt=3Dnull,portal=3Dnull,$1=3D<'transactions'>,$2=3D<'

test > transactions mmau prepare > modif

'>,$3=3D<'1'>,$4=3D,$5=3D,$6=3D<'110000000000007027'= >,$7=3D<'0' > >,$8=3D<'2011-01-17 00:00:00.000000 +01:00:00'>,$9=3D<'2011-07-05 > 00:00:00.000000 +02:00:00'>,$10=3D<'2011-02-15 18:15:21.733000 > +01:00:00'>,$11=3D<'1'>,$12=3D<'100'>,$13=3D<'0'>,$14=3D<'182'>) 18:15:22= =2E623 (1)=20 > FE=3D> Describe(portal=3Dnull) > 18:15:22.623 (1) FE=3D> Execute(portal=3Dnull,limit=3D0) > 18:15:22.623 (1) FE=3D> Sync > 18:15:22.639 (1) <=3DBE ParseComplete [null] > 18:15:22.639 (1) <=3DBE BindComplete [null] > 18:15:22.639 (1) <=3DBE NoData > 18:15:22.639 (1) <=3DBE CommandStatus(UPDATE 1) > 18:15:22.639 (1) <=3DBE ReadyForQuery(I) > ----- > As we can see, there is no BEGIN order before the update. >=20 > For the second link: > http://archives.postgresql.org/message-id/4D01DFA8.3060207@emaze.net I > applied the patch you proposed for the prepare() method. Nothing changed > either. The update was still commited and the postgresql logs did not > change. I tried to check what it was actually doing in the prepare() > method, to see if everything was going correctly, but I couldn't succeed > in seeing either the breakpoints or the debug logs I added. I don't see > the default PGXAConnection class logs either. Could it be possible that it > doesn't even go in the prepare() method? >=20 > Thanks for any help. > Marion >=20 > -----Message d'origine----- > De : Maurin, Marion > Envoy=C3=A9 : jeudi 10 f=C3=A9vrier 2011 19:45 > =C3=80 : 'Achilleas Mantzios'; pgsql-jdbc@postgresql.org > Objet : RE: [JDBC] PGXAConnection and autocommit problem >=20 > Thanks for those two inputs. I couldn't save time today to check but it > seems interesting. I'll test to see if it's related. >=20 > -----Message d'origine----- > De : pgsql-jdbc-owner@postgresql.org > [mailto:pgsql-jdbc-owner@postgresql.org] De la part de Achilleas Mantzios > Envoy=C3=A9 : jeudi 10 f=C3=A9vrier 2011 10:45 > =C3=80 : pgsql-jdbc@postgresql.org > Objet : Re: [JDBC] PGXAConnection and autocommit problem >=20 > =CE=A3=CF=84=CE=B9=CF=82 Thursday 10 February 2011 10:42:44 =CE=BF/=CE=B7= Heikki Linnakangas =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5: > > On 10.02.2011 09:50, Maurin, Marion wrote: > > > Yes, I think I saw that too, that the autocommit shouldn't be set from > > > outside. But shouldn't the driver itself set it to false at the > > > beginning of the transaction? ________________________________________ > > > De : pgsql-jdbc-owner@postgresql.org [pgsql-jdbc-owner@postgresql.org] > > > de la part de rsmogura [rsmogura@softperience.eu] Date d'envoi : > > > mercredi 9 f=C3=A9vrier 2011 21:13 > > > =C3=80 : pgsql-jdbc@postgresql.org > > > Objet : Re: [JDBC] PGXAConnection and autocommit problem > > >=20 > > > Driver should prevent set auto commit, or change it value in any > > > case. I thought I saw exception in code preventing this. > > >>=20 > > > On Wed, 9 Feb 2011 14:28:44 +0000, Maurin, Marion wrote: > > >> Hi, > > >>=20 > > >> I hope I'm in the right mailing list. > > >>=20 > > >> I'm currently facing a problem with Postgresql XA connections. I'm > > >> trying to have my transactions working but no rollback seems to take > > >> effect. After searching, I think the problem is about the autoCommit > > >> mode which is set to true even during the transaction. > >=20 > > It's quite possible that there's a bug somewhere in the XA driver - > > we've had several bugs related to autocommit and XA in the past. >=20 > I remember my similar case one year ago : > http://archives.postgresql.org/message-id/201003021629.07368.achill%40mat= ri > x.gatewaynet.com >=20 > Anyways Heikki helped a lot on this one i remember, and also wrote a patc= h. > Thanx Heikki! >=20 > > And I think this one is still pending: > > http://archives.postgresql.org/message-id/4D01DFA8.3060207@emaze.net. > > Could it be related? > >=20 > > Can you create a small self-contained test program to reproduce the > > issue, and post it to the list? Looking at code there is no way to set auto commit to true (actually you ca= n=20 do this using some back door and plain JDBC), but point is that auto commit= is=20 set to false in start(), and changed to true on prepare().=20 Things that comes to my head are: 1. Transaction Managers call prepare or rollback in meantime of your code,= =20 this can be due to transaction timout - it should close connection too. 2. Like above but from different reasons. In some way connection may be sha= red=20 and tried to be used in two transactions. 3. Maybe connection is used without XA, i mean missing call to start, or af= ter=20 prepare from TM? I think you should put break point on setAutoCommit in=20 AbstractJdbc2Connection, or prepare/rollback/commit and check all call stac= ks=20 to see what actully calls this. I saw one time simillar error, but didn't noticed preconditions, You wrote You use Tomcat + Atomikos, I see Spring there too. Is your bug=20 reproducible using simpler case only with tomcat / atomikos? I don't know Spring at all, but I see user transactions, do You call begin = or=20 Spring do it? Do you use multiple (or nested) transactions per call, or man= y=20 XA resources? Regards, Radek