Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0028519Openbravo ERPA. Platformpublic2015-01-05 11:112015-02-04 20:33
shuehner 
AugustoMauch 
highcriticalhave not tried
closedfixed 
5
3.0PR14Q3.2 
3.0PR15Q2 
alostale
Core
No
0028519: Java-thread apparently deadlocking in OrganizationStructureProvider.initialize
The following behavior has been observered in a customer instance.

cpu-usage flat 600% for 6 cores fully used.
Checking jstack we see 6 threads which status runnable with following end of signature
Addittionaly each of that seems to hold one open transaction while it is running (as seeing 6 db connections in status idle in transaction)

   java.lang.Thread.State: RUNNABLE
        at java.util.HashMap.put(HashMap.java:391)
        at org.openbravo.dal.security.OrganizationStructureProvider.initialize(OrganizationStructureProvider.java:114)

That looks very similar to a problem we had 6-12month ago with i think ApplicationDictionaryCache.

jstack will be attached.
Full HeapDump available on request from shu
unknown

No tags attached.
related to defect 00244213.0MP28 closed alostale ApplicationDictionaryCachedStructures is not thread safe 
txt leob-jstack-20150105-11h56.txt (63,200) 2015-01-05 11:13
https://issues.openbravo.com/file_download.php?file_id=7650&type=bug
Issue History
2015-01-05 11:11shuehnerNew Issue
2015-01-05 11:11shuehnerAssigned To => AugustoMauch
2015-01-05 11:11shuehnerModules => Core
2015-01-05 11:11shuehnerResolution time => 1421017200
2015-01-05 11:11shuehnerTriggers an Emergency Pack => No
2015-01-05 11:12shuehnerDescription Updatedbug_revision_view_page.php?rev_id=7380#r7380
2015-01-05 11:13shuehnerFile Added: leob-jstack-20150105-11h56.txt
2015-01-05 11:16shuehnerRelationship addedrelated to 0024421
2015-01-07 10:19AugustoMauchIssue Monitored: alostale
2015-01-07 10:19AugustoMauchReview Assigned To => alostale
2015-01-07 10:22hgbotCheckin
2015-01-07 10:22hgbotNote Added: 0073323
2015-01-07 10:22hgbotStatusnew => resolved
2015-01-07 10:22hgbotResolutionopen => fixed
2015-01-07 10:22hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/63a5eca5e0cefbdf99f7895ef7900aeeda0b8fc9 [^]
2015-01-08 08:04alostaleNote Added: 0073341
2015-01-08 08:04alostaleStatusresolved => closed
2015-01-08 08:04alostaleFixed in Version => 3.0PR15Q2
2015-02-04 20:33hudsonbotCheckin
2015-02-04 20:33hudsonbotNote Added: 0074116

Notes
(0073323)
hgbot   
2015-01-07 10:22   
Repository: erp/devel/pi
Changeset: 63a5eca5e0cefbdf99f7895ef7900aeeda0b8fc9
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed Jan 07 10:18:24 2015 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/63a5eca5e0cefbdf99f7895ef7900aeeda0b8fc9 [^]

Fixes bug 28519:OrganizationStructureProvider.initialize should be synchronized

The method OrganizationStructureProvider.initialize should be synchronized, because otherwise it could be executed concurrently. The first thing the method does it to check if it the OrganizationStructureProvider has been already initialized, but this is not enough to prevent the concurrent initializations.

One of the consequences of the concurrent initializations is that the three maps used in that method (naturalTreesByOrgID, parentByOrganizationID and childByOrganizationID) can be left in an inconsistent state, resulting in the a 100% CPU usage when trying to access them.

---
M src/org/openbravo/dal/security/OrganizationStructureProvider.java
---
(0073341)
alostale   
2015-01-08 08:04   
Code reviewed. This should fix the reported issue by checking the stack trace, though it was not possible to reproduce before the patch.
(0074116)
hudsonbot   
2015-02-04 20:33   
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/f36c91d0ad63 [^]
Maturity status: Test