Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0036574
TypeCategorySeverityReproducibilityDate SubmittedLast Update
backport[Openbravo ERP] Y. DBSourceManagermajorrandom2017-08-02 10:032017-08-03 13:05
ReporteralostaleView Statuspublic 
Assigned Toalostale 
PriorityimmediateResolutionfixedFixed in Version3.0PR17Q3
StatusclosedFix in branchFixed in SCM revisionfb946104af61
ProjectionnoneETAnoneTarget Version3.0PR17Q3
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned ToAugustoMauch
Web browser
ModulesCore
Regression levelQA functional test
Regression date2017-05-25
Regression introduced in releasemain
Regression introduced by commithttp://code.openbravo.com/erp/devel/pi/rev/49ac427a0d6689181afa29b95d7384f78eab2dca [^]
Triggers an Emergency PackNo
Summary

0036574: import sample data can get stuck when executed by multiple threads

DescriptionImporting sample data concurrently with several threads can cause locks at JVM level due to usage of non thread safe internal caches.

This behavior is unlike to occur, but if it happens, import sample data process lasts forever.
Steps To ReproduceWithin a multi-core run: ant install.source

Randomly it can get stuck at importing sample data step.

Checking stack traces (jstack):

"pool-1-thread-2" prio=10 tid=0x00007fac2c83f800 nid=0x4c3a runnable [0x00007fac2203f000]
   java.lang.Thread.State: RUNNABLE
    at java.util.HashMap.getEntry(HashMap.java:465)
    at java.util.HashMap.get(HashMap.java:417)
    at org.apache.ddlutils.dynabean.DynaClassCache.getDynaClass(DynaClassCache.java:99)
    at org.apache.ddlutils.dynabean.DynaClassCache.createNewInstance(DynaClassCache.java:50)
    at org.apache.ddlutils.model.Database.createDynaBeanFor(Database.java:1342)
    at org.apache.ddlutils.io.DynaSqlCreateRule.begin(DynaSqlCreateRule.java:61)
    at org.apache.commons.digester.Digester.startElement(Digester.java:1464)
    at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at org.apache.commons.digester.Digester.parse(Digester.java:1743)
    at org.apache.ddlutils.io.DatabaseDataIO.writeDataToDatabase(DatabaseDataIO.java:722)
    at org.openbravo.ddlutils.task.ImportSampledata$ImportRunner.importXmlFile(ImportSampledata.java:357)
    at org.openbravo.ddlutils.task.ImportSampledata$ImportRunner.run(ImportSampledata.java:340)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

"pool-1-thread-1" prio=10 tid=0x00007fac2c83f000 nid=0x4c39 runnable [0x00007fac2213f000]
   java.lang.Thread.State: RUNNABLE
    at java.util.HashMap.put(HashMap.java:494)
    at org.apache.ddlutils.dynabean.DynaClassCache.getDynaClass(DynaClassCache.java:103)
    at org.apache.ddlutils.dynabean.DynaClassCache.createNewInstance(DynaClassCache.java:50)
    at org.apache.ddlutils.model.Database.createDynaBeanFor(Database.java:1342)
    at org.apache.ddlutils.io.DynaSqlCreateRule.begin(DynaSqlCreateRule.java:61)
    at org.apache.commons.digester.Digester.startElement(Digester.java:1464)
    at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at org.apache.commons.digester.Digester.parse(Digester.java:1743)
    at org.apache.ddlutils.io.DatabaseDataIO.writeDataToDatabase(DatabaseDataIO.java:722)
    at org.openbravo.ddlutils.task.ImportSampledata$ImportRunner.importXmlFile(ImportSampledata.java:357)
    at org.openbravo.ddlutils.task.ImportSampledata$ImportRunner.run(ImportSampledata.java:340)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

Both threads are manipulating the same HashMap concurrently causing, in some cases, infinite loop.
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
blocks defect 0036573 closedalostale import sample data can get stuck when executed by multiple threads 

-  Notes
(0098324)
hgbot (developer)
2017-08-02 10:33

Repository: erp/backports/3.0PR17Q3
Changeset: fb946104af617509960447687aae64907670e51a
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Wed Aug 02 10:30:22 2017 +0200
URL: http://code.openbravo.com/erp/backports/3.0PR17Q3/rev/fb946104af617509960447687aae64907670e51a [^]

fixed bug 36574: import sample data can get stuck if executed concurrently

  It was caused by a concurrent modification/read of cache HashMap in DynaClassCache.

  As getDynaClass is the only method that reads and modifies this internal cache,
  the fix is to make it synchronized.

  Checked also, while importing sample data this is the only place where shared
  objects are modified.

---
M src-db/database/lib/dbsourcemanager.jar
---
(0098363)
AugustoMauch (administrator)
2017-08-03 13:05

Code reviewed and verified

- Issue History
Date Modified Username Field Change
2017-08-02 10:05 alostale Type defect => backport
2017-08-02 10:05 alostale Target Version => 3.0PR17Q3
2017-08-02 10:33 hgbot Checkin
2017-08-02 10:33 hgbot Note Added: 0098324
2017-08-02 10:33 hgbot Status scheduled => resolved
2017-08-02 10:33 hgbot Resolution open => fixed
2017-08-02 10:33 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/backports/3.0PR17Q3/rev/fb946104af617509960447687aae64907670e51a [^]
2017-08-02 10:34 alostale Review Assigned To => AugustoMauch
2017-08-03 13:05 AugustoMauch Note Added: 0098363
2017-08-03 13:05 AugustoMauch Status resolved => closed
2017-08-03 13:05 AugustoMauch Fixed in Version => 3.0PR17Q3


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker