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

View Issue DetailsJump to Notes ] Issue History ] Print ]
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Retail Modules] StoreServermajorhave not tried2017-05-02 18:082017-05-26 08:07
ReporterAugustoMauchView Statuspublic 
Assigned Tomtaal 
PrioritynormalResolutionfixedFixed in Version
StatusclosedFix in branchFixed in SCM revisionadfb82ccf422
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned ToAugustoMauch
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo

0035897: Prevent doing a commit inside an event handler (InvalidOrganizationChangeEventHandler)

DescriptionTransactions must not be committed inside an event handler, or an error like this one [1] can occur. The InvalidOrganizationChangeEventHandler invokes the MobileServerProvider.getMobileServersForOrganization method, which can end up committing a transaction if some internal structure is not initialized. That method can also be called with a boolean parameter that determines if the transaction should be commited, that version should be used instead of the current one.

[1] cdb72c84 219658 [http-bio-8080-exec-5] ERROR org.openbravo.retail.copystore.process.CopyStoreProcess -
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
    at java.lang.reflect.Constructor.newInstance(
    at java.lang.Class.newInstance(
    at org.jboss.weld.util.reflection.SecureReflections$
    at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInstantiation(
    at org.jboss.weld.util.reflection.SecureReflections.newInstance(
    at org.jboss.weld.injection.Exceptions.rethrowException(
    at org.jboss.weld.injection.Exceptions.rethrowException(
    at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(
    at org.jboss.weld.event.ObserverMethodImpl.sendEvent(
    at org.jboss.weld.event.ObserverMethodImpl.sendEvent(
    at org.jboss.weld.event.ObserverMethodImpl.notify(
    at org.jboss.weld.event.ObserverNotifier.notifyObserver(
    at org.jboss.weld.event.ObserverNotifier.notifyObservers(
    at org.jboss.weld.event.ObserverNotifier.fireEvent(
    at org.openbravo.client.kernel.event.PersistenceEventOBInterceptor.sendUpdateEvent(
    at org.openbravo.client.kernel.event.PersistenceEventOBInterceptor.onFlushDirty(
    at org.openbravo.client.kernel.event.PersistenceEventOBInterceptor$Proxy$_$$_WeldClientProxy.onFlushDirty(PersistenceEventOBInterceptor$Proxy$_$$
    at org.openbravo.dal.core.OBInterceptor.onFlushDirty(
    at org.hibernate.event.def.DefaultFlushEntityEventListener.invokeInterceptor(
    at org.hibernate.event.def.DefaultFlushEntityEventListener.handleInterception(
    at org.hibernate.event.def.DefaultFlushEntityEventListener.scheduleUpdate(
    at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(
    at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(
    at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(
    at org.hibernate.event.def.DefaultFlushEventListener.onFlush(
    at org.hibernate.impl.SessionImpl.flush(
    at org.openbravo.dal.service.OBDal.flush(
    at org.openbravo.dal.core.SessionHandler.flushRemainingChanges(
    at org.openbravo.dal.core.SessionHandler.commitAndClose(
    at org.openbravo.dal.service.OBDal.commitAndClose(
    at org.openbravo.replication.symmetricds.util.MobileServerProvider.initializeDataCachedByOrganization(
    at org.openbravo.replication.symmetricds.util.MobileServerProvider.getMobileServersForOrganization(
    at org.openbravo.replication.symmetricds.util.MobileServerProvider.getMobileServersForOrganization(
    at org.openbravo.retail.storeserver.synchronization.eventhandler.InvalidOrganizationChangeEventHandler.anyStoreServerHasNowAccessToRecord(
Steps To ReproduceI have not been able to reproduce this one, the log came from some BUT tests.
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
depends on backport 0035999RR17Q2.1 closedmtaal Prevent doing a commit inside an event handler (InvalidOrganizationChangeEventHandler) 

-  Notes
hgbot (developer)
2017-05-03 09:59

Repository: erp/pmods/org.openbravo.retail.storeserver.synchronization
Changeset: 9b51903469413969a79ddf223d9de412f30ad555
Author: Augusto Mauch <augusto.mauch <at>>
Date: Tue May 02 18:37:06 2017 +0200
URL: [^]

Fixes issue 35897: Prevents doing a commit inside an eventhandler

The eventhandler InvalidOrganizationChangeEventHandler now uses the method MobileServerProvider.getMobileServersForOrganization(String organizationId, boolean doCommit) instead of MobileServerProvider.getMobileServersForOrganization(String organizationId), which commits the transaction if some internal structure is not initialized.

M src/org/openbravo/retail/storeserver/synchronization/eventhandler/
mtaal (manager)
2017-05-07 21:38

I think the solution should be to get rid of the commit in the MobileServerProvider.initializeDataCachedByOrganization. Especially because this cache initialization only reads data and does no updates/inserts.

Imho the commit should be done by callers, many callers can expect database actions to take place and should commit their transaction.

I saw that the StoreBusinessPartnerLoaderHook also calls the MobileServerProvider using the method which does a commit, this can give also unwanted effects. So I guess it seems better to research how to get rid of the commit in the cache-building logic and let the callers manage transactions.
hgbot (developer)
2017-05-19 11:13

Repository: erp/pmods/org.openbravo.replication.symmetricds
Changeset: adfb82ccf42286d731d4d7e68b766932f75b7d3e
Author: Martin Taal <martin.taal <at>>
Date: Fri May 19 11:13:27 2017 +0200
URL: [^]

Fixes issue 35897: Prevent doing a commit inside an event handler (InvalidOrganizationChangeEventHandler)
Let the transaction handling within the provider depend if there is already a transaction or not

M src/org/openbravo/replication/symmetricds/util/
hgbot (developer)
2017-05-19 11:15

Repository: erp/pmods/org.openbravo.retail.storeserver.synchronization
Changeset: 62bea10d1a32d26737ea26eb633048d95215205d
Author: Martin Taal <martin.taal <at>>
Date: Fri May 19 11:14:32 2017 +0200
URL: [^]

Related to issue 35897: Prevent doing a commit inside an event handler (InvalidOrganizationChangeEventHandler)
No need to pass the commit parameter as the MobileServerProvider knows if it is participating in a transaction

M src/org/openbravo/retail/storeserver/synchronization/eventhandler/
M src/org/openbravo/retail/storeserver/synchronization/eventhandler/
AugustoMauch (developer)
2017-05-22 15:36

Code reviewed and verified
hgbot (developer)
2017-05-26 08:06

Repository: erp/pmods/org.openbravo.replication.symmetricds
Changeset: 3335ecfec5aeec4b55f1f1043c0b621e5876ed71
Author: Martin Taal <martin.taal <at>>
Date: Fri May 26 08:06:36 2017 +0200
URL: [^]

Related to issue 35897: Prevent doing a commit inside an event handler (InvalidOrganizationChangeEventHandler)
Add methods back for backward compatibility of modules

M src/org/openbravo/replication/symmetricds/util/
hgbot (developer)
2017-05-26 08:07

Repository: erp/pmods/org.openbravo.retail.giftcards.synchronization
Changeset: a40da9b10d534f9e54e24a90d6cbf391f6342fa3
Author: Martin Taal <martin.taal <at>>
Date: Fri May 26 08:07:17 2017 +0200
URL: [^]

Related to issue 35897: Prevent doing a commit inside an event handler (InvalidOrganizationChangeEventHandler)
Use the MobileServerProvider without commit parameter

M src/org/openbravo/retail/giftcards/synchronization/eventhandler/

- Issue History
Date Modified Username Field Change
2017-05-02 18:08 AugustoMauch New Issue
2017-05-02 18:08 AugustoMauch Assigned To => AugustoMauch
2017-05-02 18:08 AugustoMauch Triggers an Emergency Pack => No
2017-05-02 18:08 AugustoMauch Steps to Reproduce Updated View Revisions
2017-05-02 18:37 AugustoMauch Review Assigned To => mtaal
2017-05-03 09:59 hgbot Checkin
2017-05-03 09:59 hgbot Note Added: 0096328
2017-05-03 09:59 hgbot Status new => resolved
2017-05-03 09:59 hgbot Resolution open => fixed
2017-05-03 09:59 hgbot Fixed in SCM revision => [^]
2017-05-07 21:38 mtaal Note Added: 0096436
2017-05-07 21:38 mtaal Status resolved => new
2017-05-07 21:38 mtaal Resolution fixed => open
2017-05-08 11:52 mtaal Assigned To AugustoMauch => mtaal
2017-05-15 16:31 mtaal Status new => scheduled
2017-05-19 11:13 hgbot Checkin
2017-05-19 11:13 hgbot Note Added: 0096675
2017-05-19 11:13 hgbot Status scheduled => resolved
2017-05-19 11:13 hgbot Resolution open => fixed
2017-05-19 11:13 hgbot Fixed in SCM revision [^] => [^]
2017-05-19 11:15 mtaal Review Assigned To mtaal => AugustoMauch
2017-05-19 11:15 hgbot Checkin
2017-05-19 11:15 hgbot Note Added: 0096676
2017-05-22 15:36 AugustoMauch Note Added: 0096713
2017-05-22 15:36 AugustoMauch Status resolved => closed
2017-05-26 08:06 hgbot Checkin
2017-05-26 08:06 hgbot Note Added: 0096825
2017-05-26 08:07 hgbot Checkin
2017-05-26 08:07 hgbot Note Added: 0096826

Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker