Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0035060Openbravo ERPA. Platformpublic2017-01-26 14:172017-03-15 20:18
alostale 
alostale 
urgentmajoralways
closedfixed 
5
 
3.0PR17Q2 
caristu
Core
No
0035060: EntityPersistanceEventObservers are executed twice on commitAndClose
Whenever commitAndClose is invoked all EntityPersistanceEventObserver for modified objects are executed twice.

The problem is caused because Session.isDirty() check is finally causing them to be invoked, afer that, actual flush executes them again.
- Modify any dal object that has an observer
- Execute OBDal.getInstance().commitAndClose() check the observer gets executed twice

More detailed description can be found in the test cases related with this issue.
No tags attached.
related to defect 0032308 closed alostale error on update if entity persistence observer loaded current object in memory 
has duplicate design defect 0024287 closed platform Event Handler runs 2 times when the change is made by another Event Handler 
related to defect 0035062 closed alostale junit Weld tests not firing first 'begin transaction' event to DAL EventHandlers 
related to defect 0035075 closed alostale PersistanceObserver can fail if other observers for OrderLine are present 
blocks design defect 0035007 closed alostale audit trail causes excessive overhead 
Issue History
2017-01-26 14:17alostaleNew Issue
2017-01-26 14:17alostaleAssigned To => platform
2017-01-26 14:17alostaleModules => Core
2017-01-26 14:17alostaleTriggers an Emergency Pack => No
2017-01-26 14:17alostaleRelationship addedrelated to 0032308
2017-01-26 14:21alostaleRelationship addedrelated to 0024287
2017-01-26 14:22alostaleReview Assigned To => caristu
2017-01-26 14:22alostaleAssigned Toplatform => alostale
2017-01-26 14:22alostalePrioritynormal => urgent
2017-01-26 14:22alostaleStatusnew => scheduled
2017-01-26 14:23alostaleRelationship addedblocks 0035007
2017-01-27 12:17alostaleRelationship addedrelated to 0035062
2017-01-27 12:58hgbotCheckin
2017-01-27 12:58hgbotNote Added: 0093884
2017-01-27 12:58hgbotCheckin
2017-01-27 12:58hgbotNote Added: 0093886
2017-01-27 12:58hgbotStatusscheduled => resolved
2017-01-27 12:58hgbotResolutionopen => fixed
2017-01-27 12:58hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/846c5e30a86445c03ae75871caeffcebab990b9d [^]
2017-01-27 12:58hgbotCheckin
2017-01-27 12:58hgbotNote Added: 0093887
2017-01-27 14:39hgbotCheckin
2017-01-27 14:39hgbotNote Added: 0093897
2017-01-30 09:01alostaleRelationship addedrelated to 0035075
2017-01-30 09:33caristuNote Added: 0093916
2017-01-30 09:33caristuStatusresolved => closed
2017-01-30 09:33caristuFixed in Version => 3.0PR17Q2
2017-01-30 09:33caristuNote Edited: 0093916bug_revision_view_page.php?bugnote_id=0093916#r14391
2017-01-30 16:28caristuRelationship deletedrelated to 0024287
2017-01-30 16:28caristuRelationship addedhas duplicate 0024287
2017-03-15 20:18hudsonbotCheckin
2017-03-15 20:18hudsonbotNote Added: 0095125
2017-03-15 20:18hudsonbotCheckin
2017-03-15 20:18hudsonbotNote Added: 0095127
2017-03-15 20:18hudsonbotCheckin
2017-03-15 20:18hudsonbotNote Added: 0095128
2017-03-15 20:18hudsonbotCheckin
2017-03-15 20:18hudsonbotNote Added: 0095132

Notes
(0093884)
hgbot   
2017-01-27 12:58   
Repository: erp/devel/pi
Changeset: 1c0723461716e1c4a9d9bb8bad33339a93b6355d
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Thu Jan 26 14:31:05 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/1c0723461716e1c4a9d9bb8bad33339a93b6355d [^]

related to bug 35060: Observers are executed twice on commitAndClose

  added test cases

---
M modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/event/DatasourceEventObserver.java
M modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/event/OrderLineTestObserver.java
M src-test/src/org/openbravo/test/AllAntTaskTests.java
M src-test/src/org/openbravo/test/dal/DalPerformanceCriteriaTest.java
A modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/event/ObserverBaseTest.java
A modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/event/PersistanceObserver.java
---
(0093886)
hgbot   
2017-01-27 12:58   
Repository: erp/devel/pi
Changeset: 846c5e30a86445c03ae75871caeffcebab990b9d
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Jan 27 11:02:07 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/846c5e30a86445c03ae75871caeffcebab990b9d [^]

fixed bug 35060: Observers are executed twice on commitAndClose

  DAL observes got executed twice on commitAndClose because session.isDirty check
  was causing them to be called.

  Now, session dirtiness shouldn't be checked using directly session.isDirty method
  but through the new OBDal.isSessionDirty, which allows OBInterceptor to know if
  session is being checked so that it can prevent observes execution.

---
M src/org/openbravo/dal/core/OBInterceptor.java
M src/org/openbravo/dal/core/SessionHandler.java
M src/org/openbravo/dal/service/OBDal.java
---
(0093887)
hgbot   
2017-01-27 12:58   
Repository: erp/devel/pi
Changeset: ea09f236e45875780fc0de7f7a572081a24aeef3
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Jan 27 11:03:47 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/ea09f236e45875780fc0de7f7a572081a24aeef3 [^]

related to bug 35060: updated tests cases to use new API

---
M modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/event/PersistanceObserver.java
---
(0093897)
hgbot   
2017-01-27 14:39   
Repository: erp/devel/pi
Changeset: 60800d545b59b46c6f55c1a876be6e597fcaca18
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Jan 27 14:38:19 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/60800d545b59b46c6f55c1a876be6e597fcaca18 [^]

related to bug 35060: prevent double execution in DefaultJsonDataService

---
M modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java
---
(0093916)
caristu   
2017-01-30 09:33   
Code reviewed + testing OK: using new OBDal.isSessionDirty method observers are executed once.

reviewed in pi@2d51591f5a05.

(0095125)
hudsonbot   
2017-03-15 20:18   
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/54e102bef53e [^]
Maturity status: Test
(0095127)
hudsonbot   
2017-03-15 20:18   
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/54e102bef53e [^]
Maturity status: Test
(0095128)
hudsonbot   
2017-03-15 20:18   
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/54e102bef53e [^]
Maturity status: Test
(0095132)
hudsonbot   
2017-03-15 20:18   
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/54e102bef53e [^]
Maturity status: Test