Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0036419Openbravo ERPA. Platformpublic2017-07-05 14:052017-09-21 16:49
alostale 
alostale 
normalmajorhave not tried
closedfixed 
5
 
3.0PR17Q4 
AugustoMauch
Core
No
0036419: no request processed while killing abandoned sessions
In a professional instance with limited concurrent users, having abandoned sessions it is possible to reach a situation where no request is processed.

This can occur if there is a DB lock in the ad_session rows that detected as abandoned. The thread trying to kill them, waits this lock to be released in a synchronized method so no other thread can be processed as they are also waiting this lock to be released.
Couldn't reproduce following standard flows, but it is possible to emulate it:

1. Activate instance with a license limited to 1 concurrent user
2. Create an abandoned session in DB:

insert into ad_session (
    ad_session_id , ad_client_id , ad_org_id , isactive ,
    created , createdby , updated , updatedby ,
    processed , session_active , last_session_ping, login_status ,
    username)
values
  (get_uuid(), '0', '0', 'Y',
   now(), '0', now(), '0',
   'N', 'Y', now() - 1, 'S',
   'test' ) ;

3. Create a lock for that session in DB:

begin; select * from ad_session order by created desc limit 1 for update;

4. Try to open login window in several tabs

  -> None of them is completed
Performance
related to defect 0036425 closed alostale mobile sessions can be kicked out in cluster 
blocks feature request 0036477 closed alostale autorefresh professional subscription license 
Issue History
2017-07-05 14:05alostaleNew Issue
2017-07-05 14:05alostaleAssigned To => platform
2017-07-05 14:05alostaleModules => Core
2017-07-05 14:05alostaleTriggers an Emergency Pack => No
2017-07-06 08:15alostaleTag Attached: Performance
2017-07-06 08:29alostaleRelationship addedrelated to 0036425
2017-07-06 14:08alostaleAssigned Toplatform => alostale
2017-07-06 14:08alostaleReview Assigned To => AugustoMauch
2017-07-06 14:09hgbotCheckin
2017-07-06 14:09hgbotNote Added: 0097912
2017-07-06 14:10hgbotCheckin
2017-07-06 14:10hgbotNote Added: 0097913
2017-07-06 14:10hgbotStatusnew => resolved
2017-07-06 14:10hgbotResolutionopen => fixed
2017-07-06 14:10hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/76e0f1c4b33e58b7c413c696f3715e37b60f1ad1 [^]
2017-07-06 14:10hgbotCheckin
2017-07-06 14:10hgbotNote Added: 0097914
2017-07-06 14:10hgbotCheckin
2017-07-06 14:10hgbotNote Added: 0097915
2017-07-07 10:51hgbotCheckin
2017-07-07 10:51hgbotNote Added: 0097936
2017-07-07 10:51AugustoMauchNote Added: 0097937
2017-07-07 10:51AugustoMauchStatusresolved => closed
2017-07-07 10:51AugustoMauchFixed in Version => 3.0PR17Q4
2017-07-12 12:47alostaleRelationship addedblocks 0036477
2017-09-21 16:49hudsonbotCheckin
2017-09-21 16:49hudsonbotNote Added: 0099238
2017-09-21 16:49hudsonbotCheckin
2017-09-21 16:49hudsonbotNote Added: 0099239
2017-09-21 16:49hudsonbotCheckin
2017-09-21 16:49hudsonbotNote Added: 0099240
2017-09-21 16:49hudsonbotCheckin
2017-09-21 16:49hudsonbotNote Added: 0099241
2017-09-21 16:49hudsonbotCheckin
2017-09-21 16:49hudsonbotNote Added: 0099245

Notes
(0097912)
hgbot   
2017-07-06 14:09   
Repository: erp/devel/pi
Changeset: 5aed2a398dac4b1d7d0438eaf6ba27c7eb6bd492
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Wed Jul 05 14:47:20 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/5aed2a398dac4b1d7d0438eaf6ba27c7eb6bd492 [^]

related to bug 36419: no request processed while killing abandoned sessions

  Deactivate abandoned sessions in a separate DB transaction, in this manner the
  time locks in ad_session are held is reduced to only this action, before those
  locks were held till the thread was terminated.

---
M src/org/openbravo/erpCommon/obps/ActivationKey.java
A src/org/openbravo/erpCommon/obps/ActivationKey_data.xsql
---
(0097913)
hgbot   
2017-07-06 14:10   
Repository: erp/devel/pi
Changeset: 76e0f1c4b33e58b7c413c696f3715e37b60f1ad1
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Thu Jul 06 07:41:00 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/76e0f1c4b33e58b7c413c696f3715e37b60f1ad1 [^]

fixed bug 36419: no request processed while killing abandoned sessions

  * ActivationKey.getInstance is not synchronized anymore
  * Synchronization is now reduced to the places changing state
  * Session deactivation monitored by a lock to ensure there is at most one
    thread in this block, in this way, at most one thread can be wating for
    DB lock at this position

---
M src/org/openbravo/erpCommon/obps/ActivationKey.java
---
(0097914)
hgbot   
2017-07-06 14:10   
Repository: erp/devel/pi
Changeset: 79ddd2858936e1198dc7cc391563204254f94ae4
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Thu Jul 06 08:11:02 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/79ddd2858936e1198dc7cc391563204254f94ae4 [^]

related to bug 36419: no request processed while killing abandoned sessions

  Removed synchronization in WS call counter

---
M src/org/openbravo/erpCommon/obps/ActivationKey.java
---
(0097915)
hgbot   
2017-07-06 14:10   
Repository: erp/devel/pi
Changeset: 0d877e9b82122f10c66fbce1480723108168a715
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Thu Jul 06 08:21:45 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/0d877e9b82122f10c66fbce1480723108168a715 [^]

related to bug 36419: no request processed while killing abandoned sessions

  Log stack traces in case of error

---
M src/org/openbravo/erpCommon/obps/ActivationKey.java
---
(0097936)
hgbot   
2017-07-07 10:51   
Repository: erp/devel/pi
Changeset: aa2d71ec36788242f39cf46fd2482aea260fe5d8
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Fri Jul 07 10:34:39 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/aa2d71ec36788242f39cf46fd2482aea260fe5d8 [^]

Related with issue 36419: Fixes typo

---
M src/org/openbravo/erpCommon/obps/ActivationKey.java
---
(0097937)
AugustoMauch   
2017-07-07 10:51   
Code reviewed and verified in pi@aa2d71ec3678
(0099238)
hudsonbot   
2017-09-21 16:49   
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/9750b78d3e5c [^]
Maturity status: Test
(0099239)
hudsonbot   
2017-09-21 16:49   
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/9750b78d3e5c [^]
Maturity status: Test
(0099240)
hudsonbot   
2017-09-21 16:49   
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/9750b78d3e5c [^]
Maturity status: Test
(0099241)
hudsonbot   
2017-09-21 16:49   
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/9750b78d3e5c [^]
Maturity status: Test
(0099245)
hudsonbot   
2017-09-21 16:49   
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/9750b78d3e5c [^]
Maturity status: Test