Anonymous | Login
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] Y. DBSourceManagerminorhave not tried2019-05-02 16:522019-05-22 15:51
ReportershuehnerView Statuspublic 
Assigned Toalostale 
PrioritynormalResolutionfixedFixed in Version3.0PR19Q3
StatusclosedFix in branchFixed in SCM revision804489012532
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Toshuehner
Web browser
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo

0040754: OutOfMemory error on export.database in validation part with many modules and default heap assignment

DescriptionIn case of having many modules and running export.database with most/all of them in development using default heap-size export.database fails sometimes with OutOfMemory or GC Overhead limit exceeded.

Example is ci job: mod-merged-old-stack failing around once a week

Errors have been seen in 2 different location at runtime
a.) flush in export.db code after look running 'validation' (which is using DAL)
b.) Also inside loop doing the validation as seen in following example stacktrace
     [java] 66510 [main] INFO org.openbravo.ddlutils.task.ExportDatabase - Exporting model of module: Carrier Integration Base
     [java] 66533 [main] INFO org.openbravo.ddlutils.task.ExportDatabase - Database [name=PostgreSql server; 1 tables; 0 sequences; 0 views; 0 functions; 1 triggers]
     [java] 66534 [main] INFO org.openbravo.ddlutils.task.ExportDatabase - Checking translation consistency
     [java] 66932 [main] INFO org.openbravo.ddlutils.task.ExportDatabase - Translation consistency check finished succesfully in 397 ms
     [java] 66981 [main] INFO org.openbravo.ddlutils.task.ExportDatabase - Validating Module...
     [java] Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
     [java] at java.util.LinkedHashMap.newNode(
     [java] at java.util.HashMap.putVal(
     [java] at java.util.HashMap.put(
     [java] at org.hibernate.engine.spi.BatchFetchQueue.addBatchLoadableCollection(
     [java] at org.hibernate.engine.internal.StatefulPersistenceContext.addUninitializedCollection(
     [java] at org.hibernate.type.CollectionType.getCollection(
     [java] at org.hibernate.type.CollectionType.resolveKey(
     [java] at org.hibernate.type.CollectionType.resolve(
     [java] at org.hibernate.engine.internal.TwoPhaseLoad.doInitializeEntity(
     [java] at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntity(
     [java] at org.hibernate.loader.Loader.initializeEntitiesAndCollections(
     [java] at org.hibernate.loader.Loader.processResultSet(
     [java] at org.hibernate.loader.Loader.doQuery(
     [java] at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(
     [java] at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(
     [java] at org.hibernate.loader.Loader.loadCollectionBatch(
     [java] at org.hibernate.loader.collection.plan.LegacyBatchingCollectionInitializerBuilder$LegacyBatchingCollectionInitializer.initialize(
     [java] at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(
     [java] at org.hibernate.event.internal.DefaultInitializeCollectionEventListener.onInitializeCollection(
     [java] at org.hibernate.internal.SessionImpl.initializeCollection(
     [java] at org.hibernate.collection.internal.AbstractPersistentCollection$4.doWork(
     [java] at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(
     [java] at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(
     [java] at
     [java] at org.hibernate.collection.internal.PersistentBag.iterator(
     [java] at org.openbravo.service.system.DatabaseValidator.matchColumns(
     [java] at org.openbravo.service.system.DatabaseValidator.validate(
     [java] at org.openbravo.service.system.SystemService.validateDatabase(
     [java] at org.openbravo.ddlutils.task.ExportDatabase.validateDatabaseForModule(
     [java] at org.openbravo.ddlutils.task.ExportDatabase.execute(
     [java] at org.openbravo.ddlutils.task.ExportDatabase.main(
Steps To Reproducei.e. as many module as current mod-merged job with default heap-assignment and enough repetitions of the export.database job
Proposed Solution- DAL usage inside export.database is only for valiation part and nothing else
- While that is planned to be removed/refactored without dal in long term needs to work now
- Validation should only ever read data and not dirty any.

So .clear() just after the validate part inside the module loop should be possible and assuming DAL session size is the memory hog here fix the problem.

TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to design defect 0040801 acknowledgedplatform do not use dal in module validation 

-  Notes
hgbot (developer)
2019-05-07 13:05

Repository: erp/devel/pi
Changeset: 804489012532f36ec7fb9a7c2e9b30a5d19799ec
Author: Asier Lostalé <asier.lostale <at>>
Date: Tue May 07 12:58:29 2019 +0200
URL: [^]

fixed issue 40754: OOM on export.database in validation part with many modules

  Validate model part of export database throws OOM error when there are many
  modules to check.

  This patch:
    - Clears DAL session after validating each module as this process never does
      any modification and there is no reutilization all loaded objects can be
      safely evited from 1st level cache.
    - Removes unused map retainig all AD tables.
    - Filters tables by datatype in query instead of in JVM.

M src/org/openbravo/service/system/
hudsonbot (developer)
2019-05-21 15:17

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: [^]
Maturity status: Test
shuehner (administrator)
2019-05-22 15:51

Code-review -> fine.
- Removing unused list + moving manual if as filter in java to hql -> fine
- .getSession().clear()
  - is at very end after which no DAL objects are retained by all callers
  - checked all validation code to only read data so no .flush() is needed before clear by definition
- OOM / GC Overhead limit exceeded happening sporadicly in CI before has not been seen ever since.

- Issue History
Date Modified Username Field Change
2019-05-02 16:52 shuehner New Issue
2019-05-02 16:52 shuehner Assigned To => platform
2019-05-02 16:52 shuehner Modules => Core
2019-05-02 16:52 shuehner Triggers an Emergency Pack => No
2019-05-07 12:59 alostale Assigned To platform => alostale
2019-05-07 13:04 alostale Relationship added related to 0040801
2019-05-07 13:05 hgbot Checkin
2019-05-07 13:05 hgbot Note Added: 0111543
2019-05-07 13:05 hgbot Status new => resolved
2019-05-07 13:05 hgbot Resolution open => fixed
2019-05-07 13:05 hgbot Fixed in SCM revision => [^]
2019-05-07 13:05 alostale Review Assigned To => caristu
2019-05-07 13:06 alostale Review Assigned To caristu => shuehner
2019-05-21 15:17 hudsonbot Checkin
2019-05-21 15:17 hudsonbot Note Added: 0112016
2019-05-22 15:51 shuehner Note Added: 0112074
2019-05-22 15:51 shuehner Status resolved => closed
2019-05-22 15:51 shuehner Fixed in Version => 3.0PR19Q3

Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker