Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0036141Openbravo ERPA. Platformpublic2017-05-30 17:052017-06-08 17:12
alostale 
alostale 
normalmajorhave not tried
closedfixed 
5
 
3.0PR17Q3 
caristu
Core
No
0036141: stateful WS calls create HttpSessions that live till Tomcat kills them
Whenever a call to a stateful WebService is done, a new HttpSession is correctly created in Tomcat. This session is not automatically closed when request finalizes, so it's kept till Tomcat times it out (typically after one hour).

In instances with many WS requests this can potentially cause a high heap consumption.
1. Enable debug logging in org.openbravo.erpCommon.security.SessionListener
2. Execute 1000 times http://localhost:8080/openbravo/ws/dal/Country/100 [^]
   -> Check logs: 1000 sessions are created and kept
3. Stop Tomcat
   -> Check logs: there are 100 lines like:
d05203b3 2550326 [localhost-startStop-2] INFO org.openbravo.erpCommon.security.SessionListener - Deactivated session: 4BC123C1CC9F40C0BCD387BBA1DD5179
4. Take a memory dump
   -> Check there are 1000 retained session objects retaining up to ~900KB
Make configurable interval after request completion to expire the session (defaulting it to 1 minute).
Performance
related to design defect 0035994 closed caristu Web service calls should not create ad_session entries being in an instance with unlimited web service calls 
related to design defect 0036162 acknowledged Triage Platform Base clean up openbravo.log 
diff 36141.diff (2,028) 2017-05-30 17:07
https://issues.openbravo.com/file_download.php?file_id=10813&type=bug
png Selection_187.png (8,031) 2017-05-30 17:10
https://issues.openbravo.com/file_download.php?file_id=10814&type=bug
png
Issue History
2017-05-30 17:05alostaleNew Issue
2017-05-30 17:05alostaleAssigned To => platform
2017-05-30 17:05alostaleModules => Core
2017-05-30 17:05alostaleTriggers an Emergency Pack => No
2017-05-30 17:05alostaleRelationship addedrelated to 0035994
2017-05-30 17:07alostaleFile Added: 36141.diff
2017-05-30 17:07alostaleTag Attached: Performance
2017-05-30 17:10alostaleFile Added: Selection_187.png
2017-05-30 17:12alostaleSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=15242#r15242
2017-05-30 17:16alostaleNote Added: 0097022
2017-05-31 10:41alostaleSummarystatefull WS calls create HttpSessions that live till Tomcat kills them => stateful WS calls create HttpSessions that live till Tomcat kills them
2017-05-31 10:41alostaleDescription Updatedbug_revision_view_page.php?rev_id=15246#r15246
2017-06-01 16:52alostaleProposed Solution updated
2017-06-01 16:52alostaleAssigned Toplatform => alostale
2017-06-01 16:53alostaleReview Assigned To => caristu
2017-06-01 17:13hgbotCheckin
2017-06-01 17:13hgbotNote Added: 0097084
2017-06-01 17:13hgbotStatusnew => resolved
2017-06-01 17:13hgbotResolutionopen => fixed
2017-06-01 17:13hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/0d4ef3abdea42bf29136282daccb0753c96420f9 [^]
2017-06-01 17:16alostaleRelationship addedduplicate of 0036162
2017-06-01 17:16alostaleRelationship replacedrelated to 0036162
2017-06-05 10:06caristuNote Added: 0097120
2017-06-05 10:06caristuStatusresolved => closed
2017-06-05 10:06caristuFixed in Version => 3.0PR17Q3
2017-06-05 13:40hgbotCheckin
2017-06-05 13:40hgbotNote Added: 0097131
2017-06-05 13:40caristuNote Deleted: 0097120
2017-06-05 13:40caristuNote Added: 0097132
2017-06-08 17:12hudsonbotCheckin
2017-06-08 17:12hudsonbotNote Added: 0097234
2017-06-08 17:12hudsonbotCheckin
2017-06-08 17:12hudsonbotNote Added: 0097240

Notes
(0097022)
alostale   
2017-05-30 17:16   
Attached proposed solution
(0097084)
hgbot   
2017-06-01 17:13   
Repository: erp/devel/pi
Changeset: 0d4ef3abdea42bf29136282daccb0753c96420f9
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Thu Jun 01 16:58:38 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/0d4ef3abdea42bf29136282daccb0753c96420f9 [^]

fixed bug 36141: stateful WS calls create long lived HttpSessions

  - Now expiration time for sessions in WS calls is configurable through
    ws.maxInactiveInterval property, which defaults to 1 minute
  - Removed log while destroying context to just summarize number of sessions
    to deactive from DB + spent time.

---
M src/org/openbravo/erpCommon/security/SessionListener.java
M src/org/openbravo/service/web/BaseWebServiceServlet.java
---
(0097131)
hgbot   
2017-06-05 13:40   
Repository: erp/devel/pi
Changeset: 864ef8d7eee8c1bcb84a70cdb9196ec3ef98d959
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Mon Jun 05 13:38:50 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/864ef8d7eee8c1bcb84a70cdb9196ec3ef98d959 [^]

related to bug 36141: use variable instead of invoking the method again

---
M src/org/openbravo/service/web/BaseWebServiceServlet.java
---
(0097132)
caristu   
2017-06-05 13:40   
Code reviewed + testing OK.
(0097234)
hudsonbot   
2017-06-08 17:12   
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/fda0f16ab470 [^]
Maturity status: Test
(0097240)
hudsonbot   
2017-06-08 17:12   
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/fda0f16ab470 [^]
Maturity status: Test