Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0037055Openbravo ERPA. Platformpublic2017-10-11 14:102018-01-03 12:38
caristu 
caristu 
highmajoralways
closedfixed 
5
 
3.0PR18Q1 
alostale
Core
No
0037055: Connection leak in threads that makes use of the read only pool and are not encapsulated inside DalThreadHandler
Connection leak in threads that makes use of the read only pool and are not encapsulated inside DalThreadHandler.

This problem affects:

- Classes extending ImportEntryProcessRunnable (MobileImportEntryProcessorRunnable in WebPOS, EDLEntryProcessRunnable in EDL module)

- Classes extending DALBaseProcess (background process)
1) Install the attached module, it contains an EDL process which does a dummy usage of the read only pool on its item processor.
2) Log-in and navigate to the [Import UOM] process window.
3) Execute select state,* from pg_stat_activity where state = 'idle in transaction' --> 0 records returned
4) Being on the [Import UOM] window, click on the "Done" button in order to execute the process
5) Execute select state,* from pg_stat_activity where state = 'idle in transaction' --> 1 record returned!
Close the opened sessions in the ImportEntryProcessRunnable when it ends, in the same way as the DalThreadHandler does.
No tags attached.
related to design defect 0036291 acknowledged Triage Platform Base even not configured, RO pool uses a different pool instance 
related to feature request 0034816 closed caristu Support a second database for reporting 
gz org.openbravo.externaldata.integration.examples.tar.gz (4,841) 2017-10-11 14:10
https://issues.openbravo.com/file_download.php?file_id=11170&type=bug
diff issue37055.diff (3,757) 2017-10-11 18:58
https://issues.openbravo.com/file_download.php?file_id=11175&type=bug
Issue History
2017-10-11 14:10caristuNew Issue
2017-10-11 14:10caristuAssigned To => platform
2017-10-11 14:10caristuFile Added: org.openbravo.externaldata.integration.examples.tar.gz
2017-10-11 14:10caristuModules => Core
2017-10-11 14:10caristuTriggers an Emergency Pack => No
2017-10-11 14:13caristuAssigned Toplatform => caristu
2017-10-11 14:17caristuRelationship addedrelated to 0036291
2017-10-11 14:17caristuRelationship addedrelated to 0034816
2017-10-11 16:38caristuStatusnew => scheduled
2017-10-11 17:00caristuSummaryConnection leak when having an ImportEntryProcessRunnable that makes use of the read only pool => Connection leak in threads that makes use of the read only pool and are not encapsulated inside DalThreadHandler
2017-10-11 17:00caristuDescription Updatedbug_revision_view_page.php?rev_id=16064#r16064
2017-10-11 17:00caristuProposed Solution updated
2017-10-11 18:32caristuFile Added: issue37055.diff
2017-10-11 18:32caristuNote Added: 0099872
2017-10-11 18:33caristuNote Edited: 0099872bug_revision_view_page.php?bugnote_id=0099872#r16066
2017-10-11 18:58caristuFile Deleted: issue37055.diff
2017-10-11 18:58caristuFile Added: issue37055.diff
2017-10-16 09:50hgbotCheckin
2017-10-16 09:50hgbotNote Added: 0099916
2017-10-16 09:58caristuNote Deleted: 0099872
2017-10-16 10:25hgbotCheckin
2017-10-16 10:25hgbotNote Added: 0099917
2017-10-16 10:25hgbotStatusscheduled => resolved
2017-10-16 10:25hgbotResolutionopen => fixed
2017-10-16 10:25hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/70081b11d3a49b91c9dcac9e5898b88c37548ab0 [^]
2017-10-16 10:27caristuReview Assigned To => alostale
2017-10-24 13:01alostaleNote Added: 0100023
2017-10-24 13:01alostaleStatusresolved => closed
2017-10-24 13:01alostaleFixed in Version => 3.0PR18Q1
2018-01-03 12:38hudsonbotCheckin
2018-01-03 12:38hudsonbotNote Added: 0101331
2018-01-03 12:38hudsonbotCheckin
2018-01-03 12:38hudsonbotNote Added: 0101332

Notes
(0099916)
hgbot   
2017-10-16 09:50   
Repository: erp/devel/pi
Changeset: fb697bb857f805552ed27c221a8433ae4761016d
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Mon Oct 16 09:35:47 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/fb697bb857f805552ed27c221a8433ae4761016d [^]

related to issue 37055: initial code clean up
  - Use diamond operator
  - In ImportEntryProcessRunnable class declaration, reorder the modifiers to comply with the Java Language Specification
  - Use && instead of &

---
M src/org/openbravo/service/importprocess/ImportEntryProcessor.java
---
(0099917)
hgbot   
2017-10-16 10:25   
Repository: erp/devel/pi
Changeset: 70081b11d3a49b91c9dcac9e5898b88c37548ab0
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Mon Oct 16 10:07:39 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/70081b11d3a49b91c9dcac9e5898b88c37548ab0 [^]

fixes bug 37055: RO pool not closed when used in thread out of DalThreadHandler

 Regular threads used in HTTP requests are encanpsulated inside DalThreadHandler which eventually takes care of closing the opened database sessions before the thread ends. But threads not encapsulated inside DalThreadHandler are not taking into account the scenario of having multiple sessions (pools) opened. They are just closing the default pool. Thus, this issue affects:
  a) ImportEntryProcessRunnable, which delegates into its subclasses the ability of handling the transaction commit/rollback. But just in case the subclasses does not handle it, the ImportEntryProcessRunnable should take care of closing all the opened sessions before ending (if any). This way its behavior will be the same as those threads running inside DalThreadHandler.
  b) DalBaseProcess, this class was neither taking into account the possibility of opening multiple pools during its execution. Now, all the opened database sessions are closed if the process has been marked to close the default database connection before ending.

---
M src/org/openbravo/dal/core/SessionHandler.java
M src/org/openbravo/service/db/DalBaseProcess.java
M src/org/openbravo/service/importprocess/ImportEntryProcessor.java
---
(0100023)
alostale   
2017-10-24 13:01   
reviewed

tested with Import entry and background processes
(0101331)
hudsonbot   
2018-01-03 12:38   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/c81e0d3cbab5 [^]
Maturity status: Test
(0101332)
hudsonbot   
2018-01-03 12:38   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/c81e0d3cbab5 [^]
Maturity status: Test