pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mikko Tiihonen <mikko.tiihonen@nitorcreations.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: binary patch problems
Date: Fri, 16 Sep 2011 16:20:08 +0300
Message-ID: <4E734D08.10205@nitorcreations.com> (raw)
In-Reply-To: <CADK3HHKpQi8NCqBc98_FR04Ad14inweCDmXd2bkXBHqFNg+jEw@mail.gmail.com>
References: <CADK3HHKpQi8NCqBc98_FR04Ad14inweCDmXd2bkXBHqFNg+jEw@mail.gmail.com>

On 09/16/2011 01:10 AM, Dave Cramer wrote:
> I have applied to the current code and the tests fail with ResultSet
> already closed. I can't replicate this in eclipse, only in the command
> line ant test. My guess is that somehow result sets are being shared
> across tests. Anyone shed some light on this ? The patch I applied is
> at http://wiki.postgresql.org/wiki/JDBC-BinaryTransfer version 13
> Dave Cramer

I've been lately trying to figure out the same problem.
In separate emails I just sent the refreshed set of patches broken into separate patches out for easier review.

The trace shows that for some reason the C_5 portal is closed while still processing the results.

(3)  FE=> Execute(portal=C_5,limit=1)
(3)  FE=> Sync
(3)  <=BE DataRow(len=305)
(3)  <=BE PortalSuspended
(3)  <=BE ReadyForQuery(T)
(3)  FE=> Execute(portal=C_5,limit=1)
(3)  FE=> Sync
(3)  <=BE DataRow(len=305)
(3)  <=BE PortalSuspended
(3)  <=BE ReadyForQuery(T)
(3)  FE=> CloseStatement(S_2)
(3)  FE=> ClosePortal(C_5)
(3)  FE=> Execute(portal=C_5,limit=1)
(3)  FE=> Sync
(3)  <=BE CloseComplete
(3)  <=BE CloseComplete
(3)  <=BE ErrorMessage(ERROR: portal "C_5" does not exist
  Location: File: postgres.c, Routine: exec_execute_message, Line: 1844
  Server SQLState: 34000)
org.postgresql.util.PSQLException: ERROR: portal "C_5" does not exist
  Location: File: postgres.c, Routine: exec_execute_message, Line: 1844
  Server SQLState: 34000
       at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2158)
       at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1887)
       at org.postgresql.core.v3.QueryExecutorImpl.fetch(QueryExecutorImpl.java:2090)
       at org.postgresql.jdbc2.AbstractJdbc2ResultSet.next(AbstractJdbc2ResultSet.java:1870)
       at org.postgresql.test.jdbc2.DatabaseEncodingTest.testEncoding(DatabaseEncodingTest.java:149)

The C_5 portal is closed because it is in the openPortalCleanupQueue containing PhantomReferences. The trace shows that S_2 is also closed at the same
time, which is correct because that statement is no longer in use.

If I debugged it correctly it looks like the query statement is closed by finalizer during the test which in turn closes the relevant portals.
If I add stmt.close() to the end of the test there are no failures as it keeps the GC from killing of the statement during the test.

But why I only seem to get it when running with binary transfer patches I do not know. So there must be something in the patches that I cannot spot.

-Mikko



view thread (20+ messages)  latest in thread

Message-ID: <4E734D08.10205@nitorcreations.com>
Permalink:  ../4E734D08.10205@nitorcreations.com/
Also on:    postgresql.org/message-id/4E734D08.10205@nitorcreations.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: mikko.tiihonen@nitorcreations.com
  Subject: Re: binary patch problems
  In-Reply-To: <4E734D08.10205@nitorcreations.com>
  References: <CADK3HHKpQi8NCqBc98_FR04Ad14inweCDmXd2bkXBHqFNg+jEw@mail.gmail.com> <4E734D08.10205@nitorcreations.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox