Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0036352Openbravo ERPA. Platformpublic2017-06-27 08:342022-02-01 08:05
caristu 
Triage Platform Base 
normalminoralways
acknowledgedopen 
5
 
 
Core
No
0036352: Still there are requests for standard 2.50 buttons that borrow 2 connections
When a 2.50 style process is opened some requests are performed each of them borrowing 2 connections due to XmlEngine translation (see 0036293).

This issue is a continuation of issue 0036299
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. Select a Sales Order
4. Click on Book button
  -> check log (among others):

595dbc4c 59307 [http-bio-8080-exec-7] WARN org.openbravo.util.db.DBPoolLogger - ** Listing other 1 active connections for this thread in addition to new PooledConnection[org.postgresql.jdbc.PgConnection@32b7429f] **
595dbc4c 59307 [http-bio-8080-exec-7] WARN org.openbravo.util.db.DBPoolLogger - ===================== ACTIVE - 2017-06-26 19:38:18.195 - 1498498698195 - PooledConnection[org.postgresql.jdbc.PgConnection@4cc72345]
  Thread: http-bio-8080-exec-7
   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.base.HttpBaseServlet.getPreparedStatement(HttpBaseServlet.java:386)
   org.openbravo.base.secureApp.ClassInfoData.select(ClassInfoData.java:82)
   org.openbravo.base.secureApp.ClassInfoData.select(ClassInfoData.java:45)
   org.openbravo.base.secureApp.HttpSecureAppServlet.init(HttpSecureAppServlet.java:132)


595dbc4c 59361 [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.base.HttpBaseServlet.getPreparedStatement(HttpBaseServlet.java:386)
  org.openbravo.erpCommon.utility.WindowAccessData.hasReadOnlyAccess(WindowAccessData.java:91)
  org.openbravo.erpWindows.SalesOrder.Header.doPost(Header.java:144)
  org.openbravo.base.HttpBaseServlet.doGet(HttpBaseServlet.java:294)

595dbc4c 59362 [http-bio-8080-exec-3] WARN org.openbravo.util.db.DBPoolLogger - ** Listing other 1 active connections for this thread in addition to new PooledConnection[org.postgresql.jdbc.PgConnection@32b7429f] **
595dbc4c 59362 [http-bio-8080-exec-3] WARN org.openbravo.util.db.DBPoolLogger - ===================== ACTIVE - 2017-06-26 19:38:18.241 - 1498498698241 - PooledConnection[org.postgresql.jdbc.PgConnection@4cc72345]
  Thread: http-bio-8080-exec-3
   org.openbravo.dal.core.SessionHandler.getNewConnection(SessionHandler.java:300)
   org.openbravo.dal.core.SessionHandler.createSession(SessionHandler.java:235)
   org.openbravo.dal.core.SessionHandler.begin(SessionHandler.java:561)
   org.openbravo.dal.core.SessionHandler.getSession(SessionHandler.java:183)
   org.openbravo.dal.service.OBQuery.getSession(OBQuery.java:542)
   org.openbravo.dal.service.OBQuery.createQuery(OBQuery.java:242)
   org.openbravo.dal.service.OBQuery.list(OBQuery.java:120)
   org.openbravo.erpCommon.businessUtility.Preferences.getPreferences(Preferences.java:462)

---
[1] http://centralrepository.openbravo.com/openbravo/org.openbravo.forge.ui/sso/ForgeModuleDetail/DB-Pool-Logging-Utilities [^]
Attached patch with the proposed solution, it is pending to be reviewed because is not complete.

Currently it is not using the same transaction to create a pistance and the AD_PINSTANCE_PARA data. Thus, it causes the following error, for example when launching the "Create Periods" process:

ERROR org.openbravo.erpCommon.reference.PInstanceProcessData - SQL error in query: INSERT INTO AD_PINSTANCE_PARA (ad_pinstance_para_id, AD_PINSTANCE_ID, SEQNO, PARAMETERNAME, P_STRING, AD_CLIENT_ID, AD_ORG_ID, CREATED, CREATEDBY, UPDATED, UPDATEDBY) VALUES(get_uuid(), ?,TO_NUMBER(?),?,?, ?, ?, now(), ?, now(), ?)Exception:org.postgresql.util.PSQLException: ERROR: insert or update on table "ad_pinstance_para" violates foreign key constraint "ad_pinstance_para_ad_pinstance"
  Detail: Key (ad_pinstance_id)=(EDEDC0758C5E45B589DE0462A14BE17B) is not present in table "ad_pinstance".
No tags attached.
related to defect 0036299 closed alostale many requests for standard 2.50 buttons borrow 2 connections 
blocks defect 0035855 closed alostale many standard requests borrow more than one connection from DB 
? 36299.export (13,614) 2017-06-27 08:34
https://issues.openbravo.com/file_download.php?file_id=10873&type=bug
Issue History
2017-06-27 08:34caristuNew Issue
2017-06-27 08:34caristuAssigned To => platform
2017-06-27 08:34caristuModules => Core
2017-06-27 08:34caristuTriggers an Emergency Pack => No
2017-06-27 08:34caristuFile Added: 36299.export
2017-06-27 08:34caristuRelationship addedrelated to 0036299
2017-07-03 16:18caristuProposed Solution updated
2017-07-03 16:26caristuProposed Solution updated
2017-07-03 16:29caristuProposed Solution updated
2017-07-14 10:54alostaleStatusnew => acknowledged
2017-08-04 13:29alostaleRelationship addedblocks 0035855
2022-02-01 08:05alostaleAssigned Toplatform => Triage Platform Base

There are no notes attached to this issue.