Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0050697Openbravo ERPA. Platformpublic2022-10-17 11:162022-11-03 11:38
AugustoMauch 
AugustoMauch 
normalcriticalhave not tried
closedfixed 
5
 
PR22Q3.2PR22Q3.2 
Core
No
0050697: Cycles in entities that represents data as a tree can lead to transaction that does not finish, 100% use of CPU
The data of some entities (i.e. ProductCategory) can be represented as a tree, where each entry has a single parent entry. These entities can be visualized in a tree grid.

If the data of any of these entities is not proper and there are cycles (i.e. the parent of an entry is the entry itself), then using the filter in the tree grid can lead to a database transaction that will never be closed and a close to 100% use of the CPU.
- Force a cycle in the hierarchy of any Openbravo entity, i.e. this will create a cycle in the product characteristic tree of the White Valley sampledata client (electronics category will be its own parent):

update ad_treenode set parent_id = '3ECCEC0B766E4A25A697187A58B15B71' where node_id = '3ECCEC0B766E4A25A697187A58B15B71';

- After that, open the Product Characteristic window under that client, change to the tree grid view and filter by entering a 'c'
- Nothing will be displayed in the grid filter and a transaction will remain open in the database. You can check it by checking pg_stat_activity and kill it by invoking "select pg_terminate_backend(pid)", being the pid the pid of the stuck transaction
- Fix the category data by executing:

update ad_treenode set parent_id = '5AAC980A56404867815CCF2B52804080' where node_id = '3ECCEC0B766E4A25A697187A58B15B71';
No tags attached.
blocks defect 0050549 closed AugustoMauch Cycles in entities that represents data as a tree can lead to transaction that does not finish, 100% use of CPU 
Issue History
2022-10-31 16:37guilleaerTypedefect => backport
2022-10-31 16:37guilleaerTarget Version => PR22Q3.2
2022-10-31 16:48hgbotNote Added: 0142768
2022-11-03 11:38hgbotResolutionopen => fixed
2022-11-03 11:38hgbotStatusscheduled => closed
2022-11-03 11:38hgbotFixed in Version => PR22Q3.2
2022-11-03 11:38hgbotNote Added: 0142866
2022-11-03 11:38hgbotNote Added: 0142867

Notes
(0142768)
hgbot   
2022-10-31 16:48   
Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/745 [^]
(0142866)
hgbot   
2022-11-03 11:38   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: a326f3598aa873ada699c23f63aecfc39839b231
Author: Guillermo Alvarez de Eulate <guillermo.alvarez@openbravo.com>
Date: 31-10-2022 16:47:53
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/a326f3598aa873ada699c23f63aecfc39839b231 [^]

fixed ISSUE-50697: Prevent db transaction from being kept open if cycle is detected in hierarchy

---
M modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/TreeDatasourceService.java
M src-db/database/sourcedata/AD_MESSAGE.xml
---
(0142867)
hgbot   
2022-11-03 11:38   
Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/745 [^]