Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0053779Openbravo ERPA. Platformpublic2023-10-26 14:072023-10-27 11:04
caristu 
caristu 
highmajorhave not tried
closedfixed 
5
 
PR23Q4PR23Q4 
Core
Packaging and release
2023-08-21
No
0053779: RO pool is not closed by IE threads
If the process executed by an Import Entry makes use of the RO pool, then the transactions of that pool are never closed.
1) Configure the RO pool
2) In the "External System" window, create a new external system
3) In the "Event Subscription" window, create an event subscription for the "Resend Orders" event and for the external system created in step 2). Note that being a multiple record event, the RO pool is used by default to get the data.
4) Trigger the event doing (see attached patch):
      SynchronizationEvent.getInstance()
        .triggerEvent("API_ResendOrders",
            Map.of("orders", List.of("E1987F8E432041BD9F81D3DD29D6D4CB")));
5) In database, run: select count(*) from pg_stat_activity where state ilike '%in transaction%';

Note that the count of "idle in transaction" connections is increased every time the event is triggered
No tags attached.
blocks defect 0053774 closed caristu RO pool is not closed by IE threads 
Issue History
2023-10-26 18:08caristuTypedefect => backport
2023-10-26 18:08caristuTarget Version => PR23Q4
2023-10-26 18:15hgbotNote Added: 0156413
2023-10-27 08:48hgbotNote Added: 0156436
2023-10-27 11:03alostaleNote Added: 0156444
2023-10-27 11:04alostaleStatusscheduled => resolved
2023-10-27 11:04alostaleFixed in Version => PR23Q4
2023-10-27 11:04alostaleFixed in SCM revision => https://gitlab.com/openbravo/product/openbravo/-/commit/bb1afc38f7ba4919b7f534de3015576e98368547 [^]
2023-10-27 11:04alostaleResolutionopen => fixed
2023-10-27 11:04alostaleStatusresolved => closed

Notes
(0156413)
hgbot   
2023-10-26 18:15   
Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/1031 [^]
(0156436)
hgbot   
2023-10-27 08:48   
Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/1031 [^]
(0156444)
alostale   
2023-10-27 11:03   
Fixed by commit with incorrect message:


Repository: https://gitlab.com/openbravo/product/openbravo [^] [^]
Changeset: bb1afc38f7ba4919b7f534de3015576e98368547
Author: Carlos Aristu <carlos.aristu@openbravo.com>
Date: 26-10-2023 16:16:56
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/bb1afc38f7ba4919b7f534de3015576e98368547 [^] [^]

fixes BUG-53774: RO pool is never closed by IE threads

  If a process executed in an import entry used the RO pool, the
connection was not being closed properly by the infrastructure under
some circumstances.

  We had different scenarios depending on the process being executed in
the import entry thread:

  - If the process executed was a blocking EDL process, the RO pool
session was being always closed because the postProcessEntry method was
invoked using the SessionHandler that had the reference to the open
session.

  - If the process executed in the import entry was a non-blocking EDL
process, the RO pool session was NOT being closed because the
postProcessEntry method used a SessionHandler which do not have the
reference to the open session, because it was invoked by a different
thread.

  - If the process was not an EDL process, the RO pool was being closed
in case the process was executed without errors. If the process failed,
the RO pool session was not being closed.

  Now we fix the two scenarios where the session was not being closed.

Note that for the case of a successful execution we now use
DalThreadCleaner().getInstance.cleanWithCommit() method for consistency
and to avoid some small code duplicity.

---
M src/org/openbravo/service/importprocess/ImportEntryProcessor.java