Bug 1070423 - [GSS] (6.3.0) HHH-8983 Database drivers may attach warnings to statement handles and these may accumulate and consume significant memory
Summary: [GSS] (6.3.0) 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: DR2
: EAP 6.3.0
Assignee: Brett Meyer
QA Contact: Zbyněk Roubalík
Russell Dickenson
URL:
Whiteboard:
Depends On:
Blocks: 1063408 1073082 1087625
TreeView+ depends on / blocked
 
Reported: 2014-02-26 19:39 UTC by Stephen Fikes
Modified: 2018-12-06 15:58 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
: 1073082 (view as bug list)
Environment:
Last Closed: 2014-06-28 15:25:32 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Reproducer (2.76 KB, application/x-gzip)
2014-02-26 19:39 UTC, Stephen Fikes
no flags Details

Description Stephen Fikes 2014-02-26 19:39:54 UTC
Created attachment 868158 [details]
Reproducer

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:

Comment 1 Brett Meyer 2014-02-27 15:37:29 UTC
Included in EAP 6.3.0's Hibernate ORM 4.2.9.Final upgrade

Comment 2 Brett Meyer 2014-02-27 15:56:43 UTC
https://hibernate.atlassian.net/browse/HHH-8983

Comment 3 Kabir Khan 2014-04-04 15:28:08 UTC
Fixed by upgrade -> ON_QA

Comment 4 Jan Martiska 2014-04-09 12:22:55 UTC
Verified in 6.3.0.ER1.

Comment 5 sgilda 2014-05-12 19:44:49 UTC
Changed <literal></literal> tags in Doc Text to ticks (`) to fix Bug 1096865


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