Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0048465Openbravo ERPZ. Otherspublic2022-01-21 22:102022-03-02 08:25
ivazquez 
caristu 
highmajoralways
closedfixed 
5
PR21Q2.3 
 
AugustoMauch
Core
Production - Confirmed Stable
2018-09-25
3.0PR18Q4
https://code.openbravo.com/erp/devel/pi/rev/8a73e458127f7a40f4db9fc8583db06798e0856e [^]
No
0048465: Some process definition reports stop working after upgrading from 18Q3 to 21Q2.3
After an upgrade to version 21Q2.3 it was reported that a problem occurred when trying to generate process definition reports that make use of some org.openbravo.erpCommon.utility.Utility methods (that use DAL internally) in the header and also have a subreport executing a query.

The error displayed by the stacktrace is as follows:
Caused by: java.sql.SQLException: PooledConnection has already been closed.

To clarify that in Openbravos.properties the following configuration is found this way:
db.externalPoolClassName=org.openbravo.apachejdbcconnectionpool.JdbcExternalConnectionPool

Related issue: https://issues.openbravo.com/view.php?id=47943 [^]
1.- Download and assemble a pristine in version 21Q2.3
2.- Install the module provided by the customer attached in the issue (which only has the process definition and the jaspers).
3.- Go to "Print Product" and select a product.
4.- Click on the button "Export to PDF".

Returns the following error:
net.sf.jasperreports.engine.JRException: Error preparing the statement to execute the report query.

And in the logs you can see the error mentioned above
No tags attached.
related to feature request 0028947 closed nonofrancisco Add HTML output to Process Definition reports 
related to feature request 0036736 closed AtulOpenbravo Make OB reports read-only pool "compatible" 
related to defect 0036697 closed caristu connection leak when printing a image on a jasper subreport using the Utility.showImage method 
related to defect 0032576 closed alostale connection leak when printing Requisition report 
depends on backport 0048672PR22Q1.1 closed caristu Some process definition reports stop working after upgrading from 18Q3 to 21Q2.3 
depends on backport 0048673PR21Q4.4 closed caristu Some process definition reports stop working after upgrading from 18Q3 to 21Q2.3 
caused by defect 0039261 closed jarmendariz connection leak when printing image on subreports using the Utility.showImageLogo method 
related to design defect 0030182 closed Triage Platform Base jasper subreports using DAL do leak connection + transactions 
related to defect 0048748PR21Q2.3 closed ivazquez Open database connections are left open when printing reports (post upgrade from 18Q3 to 21Q2.3) 
? com.exos.printproblem-1.0.0.obx (26,242) 2022-01-21 22:10
https://issues.openbravo.com/file_download.php?file_id=16532&type=bug
txt stacktrace.txt (3,871) 2022-01-21 22:12
https://issues.openbravo.com/file_download.php?file_id=16533&type=bug
Issue History
2022-01-21 22:10ivazquezNew Issue
2022-01-21 22:10ivazquezAssigned To => Triage Finance
2022-01-21 22:10ivazquezFile Added: com.exos.printproblem-1.0.0.obx
2022-01-21 22:10ivazquezModules => Core
2022-01-21 22:10ivazquezTriggers an Emergency Pack => No
2022-01-21 22:10ivazquezReproducibilityhave not tried => always
2022-01-21 22:12ivazquezFile Added: stacktrace.txt
2022-01-24 12:06vmromanosAssigned ToTriage Finance => platform
2022-01-24 12:21shuehnerAssigned Toplatform => Triage Platform Base
2022-01-31 13:33AugustoMauchRegression level => Production - Confirmed Stable
2022-01-31 13:33AugustoMauchRegression date => 2018-09-25
2022-01-31 13:33AugustoMauchRegression introduced in release => 3.0PR18Q4
2022-01-31 13:33AugustoMauchRegression introduced by commit => https://code.openbravo.com/erp/devel/pi/rev/8a73e458127f7a40f4db9fc8583db06798e0856e [^]
2022-01-31 13:33AugustoMauchStatusnew => acknowledged
2022-01-31 13:34AugustoMauchRelationship addedcaused by 0039261
2022-01-31 16:54AugustoMauchAssigned ToTriage Platform Base => caristu
2022-01-31 16:54AugustoMauchStatusacknowledged => scheduled
2022-02-01 11:08caristuRelationship addedrelated to 0028947
2022-02-01 11:10caristuRelationship addedrelated to 0036736
2022-02-01 18:06hgbotNote Added: 0134718
2022-02-02 12:56caristuRelationship addedrelated to 0036697
2022-02-14 12:27caristuRelationship addedrelated to 0030182
2022-02-14 15:54caristuSummaryReports stop working after upgrading from 18Q3 to 21Q2.3 => Some process definition reports stop working after upgrading from 18Q3 to 21Q2.3
2022-02-14 15:54caristuDescription Updatedbug_revision_view_page.php?rev_id=23661#r23661
2022-02-15 08:01caristuRelationship addedrelated to 0032576
2022-02-23 16:23ivazquezNote Added: 0135256
2022-02-25 10:05hgbotNote Added: 0135309
2022-02-25 10:05hgbotNote Added: 0135310
2022-02-25 10:05hgbotResolutionopen => fixed
2022-02-25 10:05hgbotStatusscheduled => closed
2022-02-25 10:05hgbotFixed in Version => PR22Q2
2022-02-25 10:05hgbotNote Added: 0135311
2022-02-25 10:11caristuStatusclosed => new
2022-02-25 10:11caristuResolutionfixed => open
2022-02-25 10:11caristuFixed in VersionPR22Q2 =>
2022-02-25 10:12caristuStatusnew => scheduled
2022-02-25 10:13caristuStatusscheduled => resolved
2022-02-25 10:13caristuFixed in SCM revision => https://gitlab.com/openbravo/product/openbravo/-/commit/820a1a85782c1fdff85a268454ad2df6946e58e8 [^]
2022-02-25 10:13caristuResolutionopen => fixed
2022-02-25 10:14caristuReview Assigned To => AugustoMauch
2022-02-25 10:14caristuStatusresolved => closed
2022-03-02 08:25hgbotNote Added: 0135376
2022-03-08 19:10ivazquezRelationship addedrelated to 0048748

Notes
(0134718)
hgbot   
2022-02-01 18:06   
Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/520 [^]
(0135256)
ivazquez   
2022-02-23 16:23   
Hello Team,

Any update on this case?

Regards,
Ignacio Vazquez
(0135309)
hgbot   
2022-02-25 10:05   
Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/520 [^]
(0135310)
hgbot   
2022-02-25 10:05   
Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: 65c1be00849b97a0c86ff2a159a717b089437259
Author: Carlos Aristu <carlos.aristu@openbravo.com>
Date: 25-02-2022 10:03:53
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/65c1be00849b97a0c86ff2a159a717b089437259 [^]

related to BUG-48465: add test cases

---
A src-test/src/org/openbravo/test/reporting/ReportingUtilsTest.java
A src-test/src/org/openbravo/test/reporting/reports/Main.jrxml
A src-test/src/org/openbravo/test/reporting/reports/Subreport.jrxml
M src-test/src/org/openbravo/test/StandaloneTestSuite.java
---
(0135311)
hgbot   
2022-02-25 10:05   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: 820a1a85782c1fdff85a268454ad2df6946e58e8
Author: Carlos Aristu <carlos.aristu@openbravo.com>
Date: 25-02-2022 10:03:53
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/820a1a85782c1fdff85a268454ad2df6946e58e8 [^]

fixes BUG-48465: manage the DAL connection of the subreports

  Jasper subreports are filled with a multi-threading mechanism. In case
the threads use DAL to retrieve any information (for example an image)
we must ensure that the DAL connection is closed to prevent connection
leaks.

  For this reason, most of the Utility class methods are closing the
connection on finish. But at the same time this can cause problems in
case the DAL connection is reused both in the header and in the
subreport query. In that case if the header closes the DAL connection
through the Utility method, then the subreport will not be able to
execute the query because the connection is already closed.

  To fix this problems, two actions are being taken:

  - We provide our own subreport runner factory to ensure that the
threads used to fill the subreports close the DAL connections when they
are finished.

  - The Utility methods are no longer closing the DAL connection, because
this not needed anymore.

---
A src/org/openbravo/dal/core/DalThreadCleaner.java
A src/org/openbravo/report/jasper/SubreportRunner.java
A src/org/openbravo/report/jasper/SubreportRunnerFactory.java
M src/org/openbravo/dal/core/DalThreadHandler.java
M src/org/openbravo/erpCommon/utility/Utility.java
M src/org/openbravo/erpReports/jasperreports.properties
---
(0135376)
hgbot   
2022-03-02 08:25   
Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: fe489aa11c01d18668bab7ef8b4bbc8b47390091
Author: Carlos Aristu <carlos.aristu@openbravo.com>
Date: 02-03-2022 08:25:12
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/fe489aa11c01d18668bab7ef8b4bbc8b47390091 [^]

related to BUG-48465: add comment

---
M src/org/openbravo/erpReports/jasperreports.properties
---