Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0052188Openbravo ERPA. Platformpublic2023-04-20 08:302023-04-20 15:31
alostale 
alostale 
urgentmajoralways
closedfixed 
5
 
PR23Q2PR23Q2 
Core
No
0052188: resources (open file descriptors and java threads) leaked on push API
Push API, technically any user of ExternalSystem, generate over the time many open file descriptors that are never closed as well as many HttpClient-xx-SelectorManager threads.

1.1 Observe a customer with usage of push API, see how open file descriptors (lsof) and HttpClient threads increase over the time. Execute for monitoring:
watch 'PID=$(jps | grep Bootstrap | cut -f1 -d " "); echo "HttpClient threads: $(jstack 
$PID | grep HttpClient- | wc -l)"; echo "pipes and polls $(lsof -p $PID | grep -e pipe -e eventpoll 
| wc -l)"'


or create the following artificial reproducer

2.1 Apply the attached reproducer
2.2 Having installed api modules, create a subscription to order creation
2.3 In Openbravo open about form to launch the reproducer
2.4 Monitor with the previous command
No tags attached.
blocks defect 0052178 closed alostale resources (open file descriptors and java threads) leaked on push API 
Issue History
2023-04-20 14:13alostaleTypedefect => backport
2023-04-20 14:13alostaleTarget Version => PR23Q2
2023-04-20 14:31hgbotNote Added: 0148643
2023-04-20 15:31hgbotResolutionopen => fixed
2023-04-20 15:31hgbotStatusscheduled => closed
2023-04-20 15:31hgbotFixed in Version => PR23Q2
2023-04-20 15:31hgbotNote Added: 0148648
2023-04-20 15:31hgbotNote Added: 0148649

Notes
(0148643)
hgbot   
2023-04-20 14:31   
Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/862 [^]
(0148648)
hgbot   
2023-04-20 15:31   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: 41ea0d93717ed1120a7546b241f850e68bef8216
Author: Asier Lostalé <asier.lostale@openbravo.com>
Date: 20-04-2023 14:28:33
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/41ea0d93717ed1120a7546b241f850e68bef8216 [^]

fixes BUG-52188: ExternalSystem instances are leaked

Injecting @Depedent scoped ExternalSystem instances in @ApplicationScoped
ExternalSystemProvider caused the former instances to be retained as part of the
latte's context. Each HttpExternalSystem references to a JDK's HttpClient
intance which causes its threads and file descriptors to be kept open forever
even after the ExternalSystem is disposed from the cache.

Instantiating them through the BeanManager (which is indirectly done by the
WeldUtils) prevents this leak

---
M src/org/openbravo/service/externalsystem/ExternalSystemProvider.java
---
(0148649)
hgbot   
2023-04-20 15:31   
Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/862 [^]