Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0036001Openbravo ERPA. Platformpublic2017-05-15 23:022017-05-29 17:43
egoitz 
alostale 
immediatemajorhave not tried
closedfixed 
5
 
3.0PR17Q3 
caristu
Core
Pre packaging ( pi )
2017-04-27
pi
https://code.openbravo.com/erp/devel/pi/rev/275afe71cbfd4e1ddd7e1b04671559bd01614af2 [^]
No
0036001: Connection leak after start the system having any servlet with "loaded-on-startup" for example: Analytics module installed
A transaction is not closed after restart tomcat when the instance has Analytics module installed.

The problem occurs for any Servlet that is marked to be loaded on startup, at this point a DAL connection is now created out of a Servlet request, so standard DalThreadHandler is not closing it.
In an environment with Analytics module installed:

1- Start tomcat

Check on the pg_stat_activity that there is a line in state='idle in transaction'

the query is:

SELECT mo.action AS TYPE, (CASE mo.action WHEN 'X' THEN mo.ad_form_id WHEN 'P' THEN mo.ad_process_id WHEN 'R' THEN mo.ad_process_id WHEN 'S' THEN mo.ad_reference_id WHEN 'C' THEN mo.ad_callout_id ELSE null END) AS ID, m.name AS NAME, /*Name is only maintained for backwards compatibility, now REPORT_TITLE is automatically filled*/ COALESCE((CASE mo.action WHEN 'X' THEN f.ad_module_id WHEN 'P' THEN p.ad_module_id WHEN 'R' THEN p.ad_module_id WHEN 'S' THEN r.ad_module_id W

Having Analytics installed this query is launched in the init method of the QueryRepositoryServlet servlet
Being this query executed on Servlet's init method, which is typically executed just once per class, the overhead of using an extra connection for 1st execution is small. So reverting init part of changeset for 0035855 is safe in this case.
Performance
related to defect 0023882 closed alostale 2 dangling DB connections after Tomcat start 
caused by defect 0035855 closed alostale many standard requests borrow more than one connection from DB 
Issue History
2017-05-15 23:02egoitzNew Issue
2017-05-15 23:02egoitzAssigned To => platform
2017-05-15 23:02egoitzModules => Core
2017-05-15 23:02egoitzResolution time => 1496008800
2017-05-15 23:02egoitzTriggers an Emergency Pack => No
2017-05-15 23:03egoitzNote Added: 0096612
2017-05-19 08:06caristuRelationship addedrelated to 0023882
2017-05-19 08:35alostaleNote Added: 0096666
2017-05-19 08:35alostaleAssigned Toplatform => egoitz
2017-05-19 08:35alostaleStatusnew => feedback
2017-05-19 08:36alostaleTag Attached: Performance
2017-05-19 08:46caristuRelationship addedcaused by 0035855
2017-05-19 09:04caristuRegression level => Pre packaging ( pi )
2017-05-19 09:04caristuRegression date => 2017-04-27
2017-05-19 09:04caristuRegression introduced in release => pi
2017-05-19 09:04caristuRegression introduced by commit => https://code.openbravo.com/erp/devel/pi/rev/275afe71cbfd4e1ddd7e1b04671559bd01614af2 [^]
2017-05-19 09:04caristuStatusfeedback => new
2017-05-19 09:04caristuSummaryConnection leak after restart and login to the system => Connection leak after restart and login to the system having Analytics module installed
2017-05-19 09:04caristuDescription Updatedbug_revision_view_page.php?rev_id=15188#r15188
2017-05-19 09:04caristuSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=15190#r15190
2017-05-19 09:05caristuNote Added: 0096669
2017-05-19 13:22caristuAssigned Toegoitz => platform
2017-05-22 08:35alostalePrioritynormal => immediate
2017-05-22 10:32alostaleSummaryConnection leak after restart and login to the system having Analytics module installed => Connection leak after start the system having Analytics module installed
2017-05-22 10:32alostaleDescription Updatedbug_revision_view_page.php?rev_id=15191#r15191
2017-05-22 10:32alostaleProposed Solution updated
2017-05-22 10:54alostaleAssigned Toplatform => alostale
2017-05-22 10:54alostaleReview Assigned To => caristu
2017-05-22 10:55hgbotCheckin
2017-05-22 10:55hgbotNote Added: 0096691
2017-05-22 10:55hgbotStatusnew => resolved
2017-05-22 10:55hgbotResolutionopen => fixed
2017-05-22 10:55hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/ed6475ed00d30181c399db5aeccc3de6e34bb4f4 [^]
2017-05-22 10:55hgbotCheckin
2017-05-22 10:55hgbotNote Added: 0096692
2017-05-25 09:20caristuNote Added: 0096774
2017-05-25 09:20caristuStatusresolved => closed
2017-05-25 09:20caristuFixed in Version => 3.0PR17Q3
2017-05-29 12:48shuehnerSummaryConnection leak after start the system having Analytics module installed => Connection leak after start the system having any servlet with "loaded-on-startup" for example: Analytics module installed
2017-05-29 17:43hudsonbotCheckin
2017-05-29 17:43hudsonbotNote Added: 0096977
2017-05-29 17:43hudsonbotCheckin
2017-05-29 17:43hudsonbotNote Added: 0096978

Notes
(0096612)
egoitz   
2017-05-15 23:03   
The query is located on the following file:

src/org/openbravo/base/secureApp/ClassInfo_data.xsql:
(0096666)
alostale   
2017-05-19 08:35   
Not reproducible with the reported steps, please provide more information to reproduce it.
(0096669)
caristu   
2017-05-19 09:05   
It seems that it can be reproduced always when the Analytics module is present.

Steps to reproduce updated.
(0096691)
hgbot   
2017-05-22 10:55   
Repository: erp/devel/pi
Changeset: ed6475ed00d30181c399db5aeccc3de6e34bb4f4
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Mon May 22 10:47:17 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/ed6475ed00d30181c399db5aeccc3de6e34bb4f4 [^]

fixed bug 36001: leaked db connection after start the system having Analytics

  A DB transaction is kept open in 'idle in transaction' state forever afeter
  Tomcat start in case there are any servlet that is loaded on startup.

---
M src/org/openbravo/base/secureApp/HttpSecureAppServlet.java
---
(0096692)
hgbot   
2017-05-22 10:55   
Repository: erp/devel/pi
Changeset: fcdc5e67ecce0650b883d667cb0463f5834b217e
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Mon May 22 10:53:27 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/fcdc5e67ecce0650b883d667cb0463f5834b217e [^]

related to bug 36001: HSAS.init log cleanup

  * Removed unneeded log for host info
  * Rephrased mehtod invokation message
  * Add context in case of error
  * Show stack traces in case of error

---
M src/org/openbravo/base/secureApp/HttpSecureAppServlet.java
---
(0096774)
caristu   
2017-05-25 09:20   
Code reviewed + testing OK.
(0096977)
hudsonbot   
2017-05-29 17:43   
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/1ee70113bdc4 [^]
Maturity status: Test
(0096978)
hudsonbot   
2017-05-29 17:43   
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/1ee70113bdc4 [^]
Maturity status: Test