Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0036228Openbravo ERPA. Platformpublic2017-06-12 13:462017-06-16 10:29
alostale 
alostale 
normalminorhave not tried
closedfixed 
5
 
3.0PR17Q3 
caristu
Core
No
0036228: SimpleCallout used as ConnectionProvider borrows 2 connections in same thread
When a SimpleCallout is used as ConnectionProvider (using this to get connection), it borrows a second connection in the thread in addition to the Dal's one.
1. Install DB Pool log module [1]
2. Configure Openbravo.properties to log threads borrowing more than one connection:
     db.pool.logger.enabled=true
     db.pool.logger.logMultipleConnectionsPerThread=true
3. Login as Openbravo admin
4. Open any draft Sales Order
5. Change it's BP
  -> Check log:
d05203b3 1680166 [http-bio-8080-exec-3] WARN org.openbravo.util.db.DBPoolLogger - ***** Trying to get a connection in a thread that already has an active connection.
  org.openbravo.database.ConnectionProviderImpl.getNewConnection(ConnectionProviderImpl.java:260)
  org.openbravo.database.ConnectionProviderImpl.getConnection(ConnectionProviderImpl.java:236)
  org.openbravo.database.ConnectionProviderImpl.getPreparedStatement(ConnectionProviderImpl.java:369)
  org.openbravo.database.ConnectionProviderImpl.getPreparedStatement(ConnectionProviderImpl.java:361)
  org.openbravo.erpCommon.ad_callouts.DelegateConnectionProvider.getPreparedStatement(DelegateConnectionProvider.java:89)
  org.openbravo.erpCommon.businessUtility.BpartnerMiscData.select(BpartnerMiscData.java:103)
  org.openbravo.erpCommon.businessUtility.BpartnerMiscData.select(BpartnerMiscData.java:81)
  org.openbravo.erpCommon.ad_callouts.SE_Order_BPartner.execute(SE_Order_BPartner.java:56)


---
[1] http://centralrepository.openbravo.com/openbravo/org.openbravo.forge.ui/sso/ForgeModuleDetail/DB-Pool-Logging-Utilities [^]
Performance
related to defect 0035855 closed alostale many standard requests borrow more than one connection from DB 
related to design defect 0036067 closed markmm82 old callouts should be refactored to implement SimpleCallout 
depends on design defect 00323663.0PR16Q4 closed inigosanchez callout invocation ineficiencies 
Issue History
2017-06-12 13:46alostaleNew Issue
2017-06-12 13:46alostaleAssigned To => alostale
2017-06-12 13:46alostaleModules => Core
2017-06-12 13:46alostaleTriggers an Emergency Pack => No
2017-06-12 13:47alostaleSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=15328#r15328
2017-06-12 13:47alostaleRelationship addeddepends on 0032366
2017-06-12 13:47alostaleRelationship addedrelated to 0035855
2017-06-12 13:48alostaleReview Assigned To => caristu
2017-06-12 13:48alostaleTag Attached: Performance
2017-06-12 13:54alostaleRelationship addedrelated to 0036067
2017-06-12 13:54hgbotCheckin
2017-06-12 13:54hgbotNote Added: 0097313
2017-06-12 13:54hgbotStatusnew => resolved
2017-06-12 13:54hgbotResolutionopen => fixed
2017-06-12 13:54hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/be9628eb622282df600ce09ebd6be7ae5fb0375b [^]
2017-06-13 07:41hudsonbotCheckin
2017-06-13 07:41hudsonbotNote Added: 0097337
2017-06-16 10:29caristuNote Added: 0097437
2017-06-16 10:29caristuStatusresolved => closed
2017-06-16 10:29caristuFixed in Version => 3.0PR17Q3

Notes
(0097313)
hgbot   
2017-06-12 13:54   
Repository: erp/devel/pi
Changeset: be9628eb622282df600ce09ebd6be7ae5fb0375b
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Mon Jun 12 13:52:53 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/be9628eb622282df600ce09ebd6be7ae5fb0375b [^]

fixed bug 36228: SimpleCallout borrows 2 connections in same thread

  When a SimpleCallout is used as ConnectionProvider (using this to get
  connection), it borrows a second connection in the thread in addition to the
  Dal's one.

  Fixed by obtaining ConnectionProvider instance from DAL's one, so that
  it reuses the same connection already borrowed in current thread.

  Note this is safe as callout instances are not shared among different threads.

---
M src/org/openbravo/erpCommon/ad_callouts/DelegateConnectionProvider.java
---
(0097337)
hudsonbot   
2017-06-13 07:41   
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/44d87c9454e7 [^]
Maturity status: Test
(0097437)
caristu   
2017-06-16 10:29   
Code reviewed + testing OK.