Bug 1073082 - [GSS] (6.2.x) HHH-8983 Database drivers may attach warnings to statement handles and these may accumulate and consume significant memory
Summary: [GSS] (6.2.x) HHH-8983 Database drivers may attach warnings to statement hand...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Hibernate
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
medium
high
Target Milestone: CR2
: EAP 6.2.3
Assignee: Brett Meyer
QA Contact: Zbyněk Roubalík
Lucas Costi
URL:
Whiteboard:
Depends On: 1070423
Blocks: eap62-cp03-blockers 1070424 1073094
TreeView+ depends on / blocked
 
Reported: 2014-03-05 17:49 UTC by Brett Meyer
Modified: 2018-12-06 16:01 UTC (History)
6 users (show)

Fixed In Version:
Clone Of: 1070423
Environment:
Last Closed: 2014-06-09 12:47:56 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Brett Meyer 2014-03-05 17:49:01 UTC
+++ This bug was initially created as a clone of Bug #1070423 +++

Description of problem:
When using Timestamp types with underlying Sybase datetime mappings, Sybase' later drivers report a warning. In the case of batch updates which impact many rows, these warnings can add up to significant memory use.

It's desirable to have Hibernate log any warnings attached to a JDBC Connection, rather than hiding them from users. Further, it is critical to clear these warnings from the statement handles to free memory.

Version-Release number of selected component (if applicable):
EAP 6.2.0 and Hibernate 4.2.7.SP1.Final

How reproducible:
Consistently

Steps to Reproduce:
1. Column map in *.hbm.xml: <property name="date" type="timestamp" column="EVENT_DATE" />
2. Underlying type in the generated table will be Sybase 'datetime'
3. Perform an insert or update (batching many inserts or update magnifies the problem)
4. In the debugger, access the statement handle and there will be warnings on it (I never found a simple way to access the handle directly in code). Alternately, stop the testcase (using the debugger or cosole read() to pause the execution - e.g. in the tearDown() metho) and extract a heap dump. In Eclipse MAT with the heap open, you can use the OQL query: 'select * from com.sybase.jdbc4.jdbc.SybPreparedStatement'. You can then sort the result by the 'Retained Heap' column and expand and see that the top of the list is the _warning member which presents the head of a list chain of SQLWarning objects. Right click _warning, select "Show Retained Set" and click Finish on the dialog to see the chained objects.

Note that I didn't find a simple way to get to the raw com.sybase.jdbc4.jdbc.SybPreparedStatement handles.

Actual results:
Memory accumulates on the underlying Sybase statement handle in the _warnings member: _warning: java.sql.SQLWarning@...

The warnings (when there are multiple due to batching) are chained together by the SQLWarning objects.

Expected results:
The warnings should be cleared at minimum and optionally logged (if logged, this must be configurable as in the case of this Sybase scenario a high volume of logging would occur).

Additional info:

--- Additional comment from Brett Meyer on 2014-02-27 10:37:29 EST ---

Included in EAP 6.3.0's Hibernate ORM 4.2.9.Final upgrade

--- Additional comment from Brett Meyer on 2014-02-27 10:56:43 EST ---

https://hibernate.atlassian.net/browse/HHH-8983

Comment 3 Martin Simka 2014-05-12 12:41:53 UTC
verified on EAP 6.2.3.CP.CR2


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