Bug 861907
Summary: | NPE thrown in SqlTableGatewayListener.getDbConn() causes the listener to stop polling | ||
---|---|---|---|
Product: | [JBoss] JBoss Enterprise SOA Platform 5 | Reporter: | Adam Kovari <akovari> |
Component: | JBossESB | Assignee: | tcunning |
Status: | ON_QA --- | QA Contact: | |
Severity: | high | Docs Contact: | |
Priority: | high | ||
Version: | 5.2.0 GA, 5.3.0 GA | CC: | nobody, rwagner, soa-p-jira, tasato, tcunning |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
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: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 862048 |
Description
Adam Kovari
2012-10-01 10:12:41 UTC
This BZ is for SOA-P 5.2. Please be aware there is an associated BZ for SOA-P 5.3. (BZ 862055) This BZ is currently associated with SOA-P 5.2 Rollup SOA_5.2_2_2012. The SOA-P 5.3 BZ (BZ 862055) is currently associated with Rollup SOA_5.3_2_2012. Tadayoshi Sato <tadayosi> made a comment on jira JBESB-3853 Proposed fix by Martin Weiler: Index: src/org/jboss/soa/esb/listeners/gateway/SqlTableGatewayListener.java =================================================================== --- src/org/jboss/soa/esb/listeners/gateway/SqlTableGatewayListener.java (revision 37737) +++ src/org/jboss/soa/esb/listeners/gateway/SqlTableGatewayListener.java (working copy) @@ -507,7 +507,7 @@ RS.close(); oConn.rollback(); - } catch (final SQLException sqle) { + } catch (Exception ex) { refreshDatasource(); } Tadayoshi Sato <tadayosi> made a comment on jira JBESB-3853 Proposed fix by Martin Weiler: {code} Index: src/org/jboss/soa/esb/listeners/gateway/SqlTableGatewayListener.java =================================================================== --- src/org/jboss/soa/esb/listeners/gateway/SqlTableGatewayListener.java (revision 37737) +++ src/org/jboss/soa/esb/listeners/gateway/SqlTableGatewayListener.java (working copy) @@ -507,7 +507,7 @@ RS.close(); oConn.rollback(); - } catch (final SQLException sqle) { + } catch (Exception ex) { refreshDatasource(); } {code} Tadayoshi Sato <tadayosi> made a comment on jira JBESB-3853 In the source code of JBoss ESB 4.10, the following object {{"oConn"}} can be null and subsequently a NPE can happen because after the first successful invocation of {{getDbConn()}} the datasource gets out of service. {code} 473 final JdbcCleanConn oConn = getDbConn(); {code} After the initial run of {{getDbConn()}} the {{JdbcCleanConn}} object is cached to_the {{dbConn}} field, so the following if block won't be executed subsequently. {code} 544 protected JdbcCleanConn getDbConn() { 545 DataSource oDS = null; 546 if (null == _dbConn) { ... 566 _dbConn = new JdbcCleanConn(oDS, transacted); 567 } {code} And rushing directly into the following line with shortage of the datasource will raise a {{SQLException}} and execute {{releaseDBConnection()}} in the catch block, where is exactly the place of resetting the {{dbConn}} field to null. {code} 569 if ((null != _dbConn) && (_dbConn.getStatements().size() == 0)) { 570 try { 571 prepareStatements(); 572 } catch (SQLException e) { 573 releaseDBConnection(); 574 _ logger.warn("Exception preparing statements", e); 575 } 576 } {code} That's why we will have a NPE at the following line 509 and eventually {{SqlTableGatewayListener}} will stop. {code} 471 protected List<Map<String, Object>> pollForCandidates() { ... 473 final JdbcCleanConn oConn = getDbConn(); ... 509 oConn.rollback(); {code} So, I'd say the {{SqlTableGatewayListener}} can terminate forever regardless of the datasource being recovered later in such a scenario that the datasource becomes unavailable temporarily and have failed to make prepared statements by chance. Tadayoshi Sato <tadayosi> made a comment on jira JBESB-3853 It seems to be a direct consequence of the changes applied for: https://issues.jboss.org/browse/JBESB-3282 https://issues.jboss.org/browse/SOA-2012 --> https://source.jboss.org/changelog/JBossESB?cs=32667 Tom Cunningham <tcunning> updated the status of jira JBESB-3854 to Resolved Tom Cunningham <tcunning> updated the status of jira JBESB-3853 to Resolved Tom Cunningham <tcunning> made a comment on jira JBESB-3853 Committed to 4.11 CP and to trunk. Tom Cunningham <tcunning> updated the status of jira JBESB-3853 to Closed Tom Cunningham <tcunning> updated the status of jira JBESB-3854 to Closed |