Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0038801Openbravo ERPA. Platformpublic2018-06-21 11:202018-06-26 13:47
AugustoMauch 
AugustoMauch 
normalmajorhave not tried
closedfixed 
5
 
 
caristu
Core
No
0038801: If flush inside TriggerHandler.enable() throws an exception, threadlocal is not cleared, thread remains with triggers disabled
If flush inside TriggerHandler.enable() throws an exception, threadlocal is not cleared, thread remains with triggers disabled.

This means that when that thread is reused the database and hibernate triggers will be disabled, although still the safety mechanisms work and the disablement will not be committed to the database.
Create a process that:
- Disables the triggers
- Adds a record that will result in an exception when the flush is done (for instance create a UOM with a name of an existing one)
- Reenable the triggers. An exception will be thrown
- Don't disable the triggers again, and place some log to show whether the triggers are disabled. The next time the previous thread executes that log, it will show that their triggers remain disabled.
No tags attached.
depends on backport 00388283.0PR18Q2.1 closed AugustoMauch If flush inside TriggerHandler.enable() throws an exception, threadlocal is not cleared, thread remains with triggers disabled 
Issue History
2018-06-21 11:20AugustoMauchNew Issue
2018-06-21 11:20AugustoMauchAssigned To => AugustoMauch
2018-06-21 11:20AugustoMauchModules => Core
2018-06-21 11:20AugustoMauchTriggers an Emergency Pack => No
2018-06-21 11:45maiteResolution time => 1531346400
2018-06-21 11:45maiteIssue Monitored: networkb
2018-06-21 17:58hgbotCheckin
2018-06-21 17:58hgbotNote Added: 0105316
2018-06-21 17:58hgbotStatusnew => resolved
2018-06-21 17:58hgbotResolutionopen => fixed
2018-06-21 17:58hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/28cc0cfb94b45de99ab260781cec14a00e8ae25e [^]
2018-06-21 18:00AugustoMauchReview Assigned To => caristu
2018-06-21 18:49hgbotCheckin
2018-06-21 18:49hgbotNote Added: 0105322
2018-06-22 12:35hgbotCheckin
2018-06-22 12:35hgbotNote Added: 0105335
2018-06-22 12:35hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/pi/rev/28cc0cfb94b45de99ab260781cec14a00e8ae25e [^] => http://code.openbravo.com/erp/devel/pi/rev/3392fa97aa1c07f41e2727f8fdfea738c8716359 [^]
2018-06-22 12:39hudsonbotCheckin
2018-06-22 12:39hudsonbotNote Added: 0105336
2018-06-22 12:40hudsonbotCheckin
2018-06-22 12:40hudsonbotNote Added: 0105337
2018-06-22 13:07caristuNote Added: 0105341
2018-06-22 13:07caristuStatusresolved => closed
2018-06-22 13:07caristuFixed in Version => 3.0PR18Q3
2018-06-25 14:04AugustoMauchNote Added: 0105360
2018-06-25 14:04AugustoMauchStatusclosed => new
2018-06-25 14:04AugustoMauchResolutionfixed => open
2018-06-25 14:04AugustoMauchFixed in Version3.0PR18Q3 =>
2018-06-25 14:04AugustoMauchStatusnew => scheduled
2018-06-25 14:04AugustoMauchStatusscheduled => resolved
2018-06-25 14:04AugustoMauchResolutionopen => fixed
2018-06-25 14:04AugustoMauchStatusresolved => closed
2018-06-26 13:47hudsonbotCheckin
2018-06-26 13:47hudsonbotNote Added: 0105452

Notes
(0105316)
hgbot   
2018-06-21 17:58   
Repository: erp/devel/pi
Changeset: 28cc0cfb94b45de99ab260781cec14a00e8ae25e
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Thu Jun 21 17:57:27 2018 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/28cc0cfb94b45de99ab260781cec14a00e8ae25e [^]

Fixes bug 38801: Error in TriggerHandler.enable doesnt leave triggers disabled

The problem was that if the flush indie TriggerHandler.enable (invoked when retrieving DAL's connection) failed, the clear method was not
invoked, and the ThreadLocal was not reset. The next time the thread was reused, it would work with disabled triggers.

Now that doesn't happen anymore because the flush is done inside the try block.

---
M src/org/openbravo/dal/core/TriggerHandler.java
---
(0105322)
hgbot   
2018-06-21 18:49   
Repository: erp/devel/pi
Changeset: 5756317d93ad48446f1d70fd0f21750b4b6240ce
Author: Gorka Gil <gorka.gil <at> openbravo.com>
Date: Thu Jun 21 18:48:23 2018 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/5756317d93ad48446f1d70fd0f21750b4b6240ce [^]

Related to issue 38801: Backed out changeset 28cc0cfb94b4 - breaks the install.source

---
M src/org/openbravo/dal/core/TriggerHandler.java
---
(0105335)
hgbot   
2018-06-22 12:35   
Repository: erp/devel/pi
Changeset: 3392fa97aa1c07f41e2727f8fdfea738c8716359
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Fri Jun 22 10:27:58 2018 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/3392fa97aa1c07f41e2727f8fdfea738c8716359 [^]

Fixes bug 38801: Error in TriggerHandler.enable doesnt leave triggers disabled

The original fix was not proper, because the DAL connection was being retrieved inside a
try-with-resources block, so it was being automatically closed.

---
M src/org/openbravo/dal/core/TriggerHandler.java
---
(0105336)
hudsonbot   
2018-06-22 12:39   
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/31731ad72b18 [^]
Maturity status: Test
(0105337)
hudsonbot   
2018-06-22 12:40   
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/31731ad72b18 [^]
Maturity status: Test
(0105341)
caristu   
2018-06-22 13:07   
Code reviewed.
(0105360)
AugustoMauch   
2018-06-25 14:04   
Reopened to create backport
(0105452)
hudsonbot   
2018-06-26 13:47   
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/0f403f60ff29 [^]
Maturity status: Test