Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0037015Openbravo ERPA. Platformpublic2017-10-05 16:582017-11-29 10:34
alostale 
alostale 
normalminorhave not tried
closedfixed 
5
 
3.0PR18Q1 
caristu
Core
No
0037015: contention in DAL proxies with high concurrency
Whenever a Hibernate proxied object is accessed to any of its methods, even if it is already hydrated, a lock is created at entity's method level, so it is only possible to access this method once a time even in different instances.

For example:

  Thread 1
     Module modInstance1 = OBDal.getInstance().get(Module.class, "0");
     Client clientProxyInstance1 = modInstance1.getClient();           // we have a proxy
     clientProxyInstance1.getId();                                     // accessing to a method in the 
proxy

  Thread 2
     Module modInstance2 = OBDal.getInstance().get(Module.class, "0"); // another Module instance
     
Client clientProxyInstance2 = modInstance1.getClient();           // another proxy instance
     clientProxyInstance2.getId();                                     // accessing to a method in the 
proxy     


In this example, clientProxyInstance1.getId() and clientProxyInstance2.getId() cannot be executed concurrently because both of them try to get a lock on Client.getId method.
-Execute attached test profiling locks and monitors
  -> See attached image where it can be seen threads waiting for RuntimeSupport.find2Methods
This is an issue [1] in the javassist version that currently Openbravo depends on (3.14.0-GA), which is fixed since 3.17.0-GA.

Decide to which version update, maybe to 3.20.0-GA, which is not the latest one but the one currently Hibernate depends on [2].

Note 3.17 seems to be buggy an Hibernate moved from it [3][4].

Testing with 3.20.0-GA solves the contention issue (see attached image) which is the same test execution without any thread waiting.

---
[1] https://issues.jboss.org/browse/JASSIST-163 [^]
[2] https://github.com/hibernate/hibernate-orm/blob/00492a3707b9128b34646166f6eff402a8169011/libraries.gradle#L20 [^]
[3] https://hibernate.atlassian.net/browse/HHH-7923 [^]
[4] https://issues.jboss.org/browse/JASSIST-189 [^]
Performance
related to design defect 0020515 closed alostale OBCriteria creates contention at JVM 
related to feature request 0037064 closed caristu upgrade hibernate to 5.3.2 
png Selection_214.png (78,055) 2017-10-05 17:04
https://issues.openbravo.com/file_download.php?file_id=11139&type=bug
png

? DalProxyConcurrency.java (2,013) 2017-10-05 17:11
https://issues.openbravo.com/file_download.php?file_id=11140&type=bug
png Same-Test-New-Jar.png (17,673) 2017-10-05 17:20
https://issues.openbravo.com/file_download.php?file_id=11141&type=bug
png
Issue History
2017-10-05 16:58alostaleNew Issue
2017-10-05 16:58alostaleAssigned To => platform
2017-10-05 16:58alostaleModules => Core
2017-10-05 16:58alostaleTriggers an Emergency Pack => No
2017-10-05 17:04alostaleSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=16033#r16033
2017-10-05 17:04alostaleFile Added: Selection_214.png
2017-10-05 17:10alostaleProposed Solution updated
2017-10-05 17:11alostaleFile Added: DalProxyConcurrency.java
2017-10-05 17:17alostaleProposed Solution updated
2017-10-05 17:18alostaleProposed Solution updated
2017-10-05 17:19shuehnerIssue Monitored: shuehner
2017-10-05 17:20alostaleFile Added: Same-Test-New-Jar.png
2017-10-05 17:21alostaleProposed Solution updated
2017-10-05 17:26alostaleTag Attached: Performance
2017-10-06 10:42alostaleRelationship addedrelated to 0020515
2017-10-06 11:16alostaleStatusnew => acknowledged
2017-10-13 12:40alostaleRelationship addedrelated to 0037064
2017-11-21 10:26hgbotCheckin
2017-11-21 10:26hgbotNote Added: 0100644
2017-11-21 10:26hgbotStatusacknowledged => resolved
2017-11-21 10:26hgbotResolutionopen => fixed
2017-11-21 10:26hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/34f3cf610264a9eb4342f421f67d179d4cbdfa7d [^]
2017-11-21 10:26alostaleAssigned Toplatform => alostale
2017-11-21 10:27alostaleReview Assigned To => caristu
2017-11-29 10:34caristuNote Added: 0100804
2017-11-29 10:34caristuStatusresolved => closed
2017-11-29 10:34caristuFixed in Version => 3.0PR18Q1

Notes
(0100644)
hgbot   
2017-11-21 10:26   
Repository: erp/devel/pi
Changeset: 34f3cf610264a9eb4342f421f67d179d4cbdfa7d
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Mon Nov 13 13:52:55 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/34f3cf610264a9eb4342f421f67d179d4cbdfa7d [^]

fixed 37015: contention in DAL proxies with high concurrency

  Updated javassisit library from 3.14.0-GA to 3.20.0-GA to solve
  JASSIST-163: RuntimeSupport.find2Methods perf hotspot when proxy's methods are called at higher concurrency [1].

   [1] https://issues.jboss.org/browse/JASSIST-163 [^]

---
M legal/Licensing.txt
A lib/runtime/javassist-3.20.0-GA.jar
R lib/runtime/javassist-3.14.0-GA.jar
---
(0100804)
caristu   
2017-11-29 10:34   
Reviewed

Updated wiki page: http://wiki.openbravo.com/wiki/Openbravo_Libraries [^]