Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0036364Openbravo ERPA. Platformpublic2017-06-27 22:332017-07-03 10:11
mtaal 
mtaal 
normalminorhave not tried
closedfixed 
5
 
3.0PR17Q33.0PR17Q3 
AugustoMauch
Core
No
0036364: Http Sessions are registered in SessionListener with wrong session id, stateless requests should not be registered
The main issue is related to the fact that all logins, even stateless ones, are registering a record in the SessionListener [1] with the wrong session id.
 
When the BaseWebService is authenticating it calls the createDBSession which creates a SessionLogin. When the SessionLogin is saved (AuthenticationManager.createDBSession line 476) it adds its key to the SessionListener. This session is never destroyed so it is never removed from the sessionInContext set of SessionListener. When tomcat stops this Set is iterated printing the info.

The second related issue is that the key stored in the sessionsInContext is not the real ad_session_id created in the database. So the updates to deactivate the sessions never update any record. :( You can check this in the SessionLogin.save(). A random key is generated and set in the SessionListner, but later the AD_Session is created but this key is not set so a different uuid is created in database.

The good thing. Is that the ad_sessions that are created in the Stateless WebService calls are created with the session_active flag to false. So they are not required to deactivate them when tomcat is stopped.

So 2 issues to fix:

1. The ad_session_id stored in SessionListener.sessionsInContext set is not the real ad_session_id created in database.
2. The ad_session records created in stateless request are already created with the session_active to false so they shouldn't be added to the session listener at all.

[1]
https://code.openbravo.com/erp/devel/pi/file/3f6b96e0cba9/src/org/openbravo/erpCommon/security/SessionLogin.java#l118 [^]
Put a breakpoint in the session listener
Run one of the stateless testcases: StatelessRetailOrderLoaderTest or TestStatelessWebService

Check that a session id is registered in the sessionlistener
Prevent stateless requests to register a session id in the sessionlistener
No tags attached.
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 
Issue History
2017-06-27 22:33mtaalNew Issue
2017-06-27 22:33mtaalAssigned To => mtaal
2017-06-27 22:33mtaalModules => Core
2017-06-27 22:33mtaalTriggers an Emergency Pack => No
2017-06-29 11:26mtaalReview Assigned To => AugustoMauch
2017-06-29 11:27mtaalSummaryStateless requests register session id in SessionListener while this should not happen => Http Sessions are registered in SessionListener with wrong session id, stateless requests should not be registered
2017-06-29 11:27mtaalDescription Updatedbug_revision_view_page.php?rev_id=15444#r15444
2017-06-29 11:28hgbotCheckin
2017-06-29 11:28hgbotNote Added: 0097754
2017-06-29 11:28hgbotStatusnew => resolved
2017-06-29 11:28hgbotResolutionopen => fixed
2017-06-29 11:28hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/7ef6d8ce4b58374e5f74e51962b1a7f6a9ee36bb [^]
2017-06-29 13:37AugustoMauchNote Added: 0097768
2017-06-29 13:37AugustoMauchStatusresolved => closed
2017-06-29 13:37AugustoMauchFixed in Version => 3.0PR17Q3
2017-06-30 17:19hudsonbotCheckin
2017-06-30 17:19hudsonbotNote Added: 0097785
2017-07-03 10:11alostaleRelationship addedrelated to 0035994

Notes
(0097754)
hgbot   
2017-06-29 11:28   
Repository: erp/devel/pi
Changeset: 7ef6d8ce4b58374e5f74e51962b1a7f6a9ee36bb
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Thu Jun 29 11:28:15 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/7ef6d8ce4b58374e5f74e51962b1a7f6a9ee36bb [^]

Fixes issue 36364: Http Sessions are registered in SessionListener with wrong session id, stateless requests should not be registered
Prevent stateless request from being registered in SessionListener.
Force the correct id in the Session record

---
M src/org/openbravo/erpCommon/security/SessionLogin.java
---
(0097768)
AugustoMauch   
2017-06-29 13:37   
Code reviewed and verified
(0097785)
hudsonbot   
2017-06-30 17:19   
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/afd14b274336 [^]
Maturity status: Test