Bug 823773 - DB2 & human tasks: Invalid operation: result set is closed
DB2 & human tasks: Invalid operation: result set is closed
Status: VERIFIED
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: jBPM Console (Show other bugs)
BRMS 5.3.0.GA
Unspecified Unspecified
unspecified Severity high
: ER9
: BRMS 5.3.0.GA
Assigned To: Shelly McGowan
Lukáš Petrovický
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-22 02:50 EDT by Zuzana Krejčová
Modified: 2016-09-20 01:16 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
stack trace of the error from the server log (5.11 KB, text/plain)
2012-05-22 02:50 EDT, Zuzana Krejčová
no flags Details
jboss-brms-ds.xml (1.20 KB, application/xml)
2012-05-24 10:15 EDT, Jiri Locker
no flags Details

  None (edit)
Description Zuzana Krejčová 2012-05-22 02:50:57 EDT
Created attachment 585937 [details]
stack trace of the error from the server log

Description of problem:
When running jBPM Console with DB2 database the following error occurs when the console queries for (personal) tasks:
ERROR [org.hibernate.util.JDBCExceptionReporter] (Thread-27) [jcc][t4][10120][10898][4.12.55] Invalid operation: result set is closed. ERRORCODE=-4470, SQLSTATE=null
ERROR [org.jbpm.task.service.TaskServerHandler] (Thread-27) org.hibernate.exception.GenericJDBCException: could not execute query

According to this: http://www-01.ibm.com/support/docview.wss?uid=swg21461670 the cause is that: "The IBM Data Server Driver for JDBC and SQLJ automatically closes the cursor when all rows have been retrieved from a ResultSet. When ResultSet.next is executed after the cursor is closed the SQLException is thrown."

The same page also contains some helpful info on how to resolve this.


Version-Release number of selected component (if applicable):
BRMS 5.3 ER7
Comment 1 Zuzana Krejčová 2012-05-22 03:25:41 EDT
Default assignee is kind of buggy. Reassigning to Marco, as he delt with the previous db2 problem. Feel free to change that.
Comment 2 Marco Rietveld 2012-05-22 07:53:49 EDT
No problem. Thanks for the link to the ibm site, Zuzana.
Comment 3 Marco Rietveld 2012-05-22 08:40:24 EDT
The ibm page seems to imply that this is a bug in hibernate 3.3.2, however maybe there's some way around it.
Comment 4 Marco Rietveld 2012-05-22 15:29:53 EDT
Zuzana, could you check which version of hibernate is being used in your tests? 

I thought it was 3.3.2.GA, but org.hibernate.loader.Loader isn't longer than 2379 lines in 3.3.2.GA (and the stack trace implies it's at least 2458 lines long).
Comment 5 Marco Rietveld 2012-05-22 15:43:40 EDT
Also, could you try testing with the following string appended to the jdbc url: 

";allowNextOnExhaustedResultSet=1"

For example: 

jdbc:db2://db2.qa.redhat.com:50000/jbossqa;allowNextOnExhaustedResultSet=1
Comment 6 Lukáš Petrovický 2012-05-23 02:26:32 EDT
(In reply to comment #4)
> Zuzana, could you check which version of hibernate is being used in your
> tests? 

Looking at the server's Hibernate JARs, they say "3.3.2.GA_CP04"

(In reply to comment #5)
> jdbc:db2://db2.qa.redhat.com:50000/jbossqa;allowNextOnExhaustedResultSet=1

Will try.
Comment 7 Lukáš Petrovický 2012-05-23 06:04:24 EDT
The property added to the URL does actually help. I think that this turns into a documentation issue now. Reassigning to Lee.

Marco, would you be able to provide the BZ/JIRA in Hibernate that causes this? So that we can track it in the future.
Comment 8 Jiri Locker 2012-05-24 10:15:44 EDT
Created attachment 586647 [details]
jboss-brms-ds.xml

Unfortunately we're still getting the SQL exception even with allowNextOnExhaustedResultSet=1. See attached data source. More investigation will be needed.
Comment 9 Marco Rietveld 2012-05-25 09:57:58 EDT
I noticed that the following setting was missing from the ds.xml: 

    <xa-datasource-property name="DriverType">4</xa-datasource-property>

I don't think this the fix, but the following sites seem to indicate that it's needed: 

http://stackoverflow.com/questions/3988059/creating-xa-datasource-to-db2-on-jboss
http://docs.codehaus.org/display/BTM/JdbcXaSupportEvaluation#JdbcXaSupportEvaluation-IBMDB2
Comment 10 Marco Rietveld 2012-05-25 11:52:42 EDT
I've been able to reproduce the problem. 

The solution to this seems to be making sure a transaction happens around queries that find at least one row/result. 

I will probably spend most of the time checking whether it causes other bugs.
Comment 11 Marco Rietveld 2012-05-25 11:58:28 EDT
Sorry, to clarify: I'll be making sure all queries run within a transaction.
Comment 12 Marco Rietveld 2012-05-25 16:21:04 EDT
Finished coding 90% of the solution and currently testing and working out kinks.
Comment 13 Marco Rietveld 2012-05-25 18:21:41 EDT
I've finished testing and coding the solution, and am now organizing the commits and adding some necessary documentation in the code (for developers who look at the code later).
Comment 14 Ryan Zhang 2012-06-13 05:32:49 EDT
This issue's fixes  have been picked by ER9. Please verify them on ER9.
Comment 15 Zuzana Krejčová 2012-06-15 04:17:47 EDT
Works like magic. Thanks.

Note You need to log in before you can comment on or make changes to this bug.