Bug 1118460

Summary: Serialization of long sqlexception/warning next chains can lead to oom
Product: [JBoss] JBoss Data Virtualization 6 Reporter: Rick Wagner <rwagner>
Component: TeiidAssignee: Jorge Perez Bolano <jperezbo>
Status: RELEASE_PENDING --- QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.0.0CC: ldimaggi
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
PATCH NAME: BZ-1118460 PRODUCT NAME: JBoss Data Virtualization VERSION: (DV) 6.0 SHORT DESCRIPTION: Serialization of long sqlexception/warning next chains can lead to oom LONG DESCRIPTION: SQLExceptions can cause Out of Memory Exceptions in serialization. MANUAL INSTALL INSTRUCTIONS: Backup and remove the following files: $DATA_VIRTUALIZATION_HOME/dataVirtualization/jdbc/teiid-8.4.1-redhat-7-jdbc.jar $DATA_VIRTUALIZATION_HOME/dataVirtualization/teiid-adminshell/lib/teiid-8.4.1-redhat-7-jdbc.jar Extract files from the .zip, place them in the following locations: teiid-8.4.2-redhat-1-jdbc.jar to $DATA_VIRTUALIZATION_HOME/dataVirtualization/jdbc teiid-8.4.2-redhat-1-jdbc.jar to $DATA_VIRTUALIZATION_HOME/dataVirtualization/teiid-adminshell/lib teiid-client-8.4.2-redhat-1.jar to $DATA_VIRTUALIZATION_HOME/modules/system/layers/dv/org/jboss/teiid/client/main Finally, edit $DATA_VIRTUALIZATION_HOME/modules/system/layers/dv/org/jboss/teiid/client/main/module.xml so the 'resource-root' tag for teiid-client contains the new jar name (teiid-client-8.4.2-redhat-1.jar). Instructions to uninstall: Remove the jdbc .jar at $DATA_VIRTUALIZATION_HOME/dataVirtualization/jdbc, replace with the backup from above. Remove the jdbc .jar at $DATA_VIRTUALIZATION_HOME/dataVirtualization/teiid-adminshell/lib, replace with the backup from above. Edit $DATA_VIRTUALIZATION_HOME/modules/system/layers/dv/org/jboss/teiid/client/main/module.xml so the 'resource-root' tag for teiid-client contains the original jar name (teiid-client-8.4.1-redhat-7.jar). DEPENDENCIES: JBoss Data Virtualization 6.0 GA SUPERSEDED BY: N/A CREATOR: Rick Wagner DATE: 11 July 2014
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Support Patch
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Fixed .jar
none
Fixed client jar
none
Single Zip of patch. none

Description Rick Wagner 2014-07-10 18:40:15 UTC
Description of problem:
The serialization logic for exception chains is not correct and will output exponentially too many instances of chained exceptions, which can lead to out of memory conditions.

Comment 2 Rick Wagner 2014-07-10 18:43:05 UTC
Created attachment 917161 [details]
Fixed .jar

Comment 3 Rick Wagner 2014-07-10 18:43:43 UTC
Created attachment 917162 [details]
Fixed client jar

Comment 4 Rick Wagner 2014-07-10 18:44:40 UTC
Delta from source change used for this fix:

[rwagner@dev113 DV1]$ diff Orig/ExceptionHolder.java Changed/ExceptionHolder.java 
129,140c129,144
<                       SQLException se = (SQLException)exception;
<                       SQLException next = se.getNextException();
<                       int count = 0;
<                       while (next != null) {
<                               count++;
<                               next = next.getNextException();
<                       }
<                       out.writeInt(count);
<                       next = se.getNextException();
<                       while (next != null) {
<                               out.writeObject(new ExceptionHolder(next, true));
<                               next = next.getNextException();
---
>                         if (nested) {
>                               out.writeInt(0);
>                       } else {
>                               SQLException se = (SQLException)exception;
>                               SQLException next = se.getNextException();
>                               int count = 0;
>                               while (next != null) {
>                                       count++;
>                                       next = next.getNextException();
>                               }
>                               out.writeInt(count);
>                               next = se.getNextException();
>                               while (next != null) {
>                                       out.writeObject(new ExceptionHolder(next, true));
>                                       next = next.getNextException();
>                               }

Comment 6 Rick Wagner 2014-07-11 13:49:03 UTC
Created attachment 917314 [details]
Single Zip of patch.

Comment 7 JBoss JIRA Server 2014-07-11 16:01:45 UTC
Johnathon Lee <jolee> updated the status of jira TEIID-3021 to Reopened

Comment 8 JBoss JIRA Server 2014-07-17 12:34:59 UTC
Steven Hawkins <shawkins> updated the status of jira TEIID-3021 to Resolved

Comment 9 Filip Elias 2014-07-31 12:11:06 UTC
All tests passed.
Verified on DV 6.0. 
The patch is in the attachment.

Comment 10 JBoss JIRA Server 2015-03-05 23:34:59 UTC
Steven Hawkins <shawkins> updated the status of jira TEIID-3021 to Closed

Comment 11 PnT Account Manager 2017-12-07 23:54:31 UTC
Employee 'felias' has left the company.