Re: binary patch problems

From: Mikko Tiihonen <mikko(dot)tiihonen(at)nitorcreations(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: binary patch problems
Date: 2011-09-16 13:20:08
Message-ID: 4E734D08.10205@nitorcreations.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2011-09-16 13:40:28 Re: binary patch problems
Previous Message Mikko Tiihonen 2011-09-16 13:14:35 Binary transfer support [7/7] - testing in ide