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: | CLOSED UPSTREAM | QA Contact: | |
| Severity: | high | Docs Contact: | |
| Priority: | high | ||
| Version: | 5.2.0 GA, 5.3.0 GA | CC: | nobody, 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: | 2025-02-10 03:20:52 UTC | 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 | ||
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 This product has been discontinued or is no longer tracked in Red Hat Bugzilla. |
Description of problem: Listener is not fetching the data from the database after the Data source disconnect and reconnect. To resolve the issue we have to redeploy the esb. Version-Release number of selected component (if applicable): JBoss SOA-P 5.2.0 How reproducible: always Steps to Reproduce: 1. deploy ESB project which uses SQL listener 2. restart database, wait few minutes 3. notice that SQL listener is stopped Actual results: SQL listener not polling Expected results: SQL listener polling Additional info: Proposed fix: 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(); }