Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0030182Openbravo ERPA. Platformpublic2015-06-15 14:302022-02-25 10:10
shuehner 
Triage Platform Base 
highminorhave not tried
closedfixed 
5
 
 
caristu
Core
No
0030182: jasper subreports using DAL do leak connection + transactions
Note: report is about behavior known to be like this some years ago. Jasper update may have changed it.

So please verify.

When jasper engine does process a jrxml having a subreport, then this subreport is processing in a separate Thread created by japser engine (subreport-filler or similar name in jstack).

If then the subreport definition uses dal (i.e. via calling some java utility methods) that somehow managed to create a dal-context in the thread (so connection+transaction)

However that transaction+connection are never committed+closed as that Thread is not covered by the usual DalThreadHandler we have for http requests.

Note: GC seems to clean that problem up after some time.
Make or find a jrxml having subreport using dal.
Run once
Observe connection (especially idle in transaction) status just after that.
Performance
related to defect 0048465 closed caristu Some process definition reports stop working after upgrading from 18Q3 to 21Q2.3 
related to defect 0032576 closed alostale connection leak when printing Requisition report 
related to defect 0036697 closed caristu connection leak when printing a image on a jasper subreport using the Utility.showImage method 
related to defect 0039261 closed jarmendariz connection leak when printing image on subreports using the Utility.showImageLogo method 
Issue History
2015-06-15 14:30shuehnerNew Issue
2015-06-15 14:30shuehnerAssigned To => platform
2015-06-15 14:30shuehnerModules => Core
2015-06-15 14:30shuehnerTriggers an Emergency Pack => No
2015-06-16 11:49alostaleStatusnew => acknowledged
2015-06-18 09:05alostaleTag Attached: Performance
2015-06-18 09:05alostalePrioritynormal => urgent
2015-06-18 09:05alostaleTarget Version => 3.0PR15Q4
2015-07-22 09:43alostaleAssigned Toplatform => caristu
2015-09-29 12:29alostaleTarget Version3.0PR15Q4 => 3.0PR16Q1
2015-11-06 11:01alostaleTarget Version3.0PR16Q1 =>
2015-11-11 11:37alostalePriorityurgent => normal
2015-11-11 12:13alostaleAssigned Tocaristu => platform
2016-04-04 11:37alostaleRelationship addedrelated to 0032576
2016-04-04 11:43alostaleNote Added: 0085404
2016-12-01 14:05alostalePrioritynormal => urgent
2016-12-01 14:05alostalePriorityurgent => high
2016-12-01 14:34alostaleTypedefect => design defect
2017-08-23 10:35caristuRelationship addedrelated to 0036697
2018-09-25 10:15caristuRelationship addedrelated to 0039261
2022-02-01 08:09alostaleAssigned Toplatform => Triage Platform Base
2022-02-14 12:27caristuRelationship addedrelated to 0048465
2022-02-25 10:10caristuStatusacknowledged => scheduled
2022-02-25 10:10caristuReview Assigned To => caristu
2022-02-25 10:10caristuNote Added: 0135312
2022-02-25 10:10caristuStatusscheduled => closed
2022-02-25 10:10caristuResolutionopen => fixed

Notes
(0085404)
alostale   
2016-04-04 11:43   
The problem is caused because Jasper subreports are generated within a new thread. When using DAL (or DalConnectionProvider), org.openbravo.dal.core.SessionHandler.getInstance() is invoked, this method creates a DAL transaction (associated with a DB connection) in a thread local if it does not exist yet, which is used to do DB queries. The problem is this transaction is never closed because standard dal thread handling is not invoked.

As workaround, when any subreport invoking backend methods that use DAL or DalConnectionProvider, it must be checked these methods close the dal connection before leaving.
(0135312)
caristu   
2022-02-25 10:10   
Fixed with 0048465