Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0036293Openbravo ERPA. Platformpublic2017-06-20 11:112022-02-01 08:08
alostale 
Triage Platform Base 
normalminorhave not tried
acknowledgedopen 
5
 
 
Core
No
0036293: XmlEngine page don't use DAL's connection
Documents generated with XmlEngine use their own ConnectionProvider set in HttpBaseServlet.init. This causes to keep a different connection than DAL's one, so a new connection is borrowed in the same thread whenever it is used.

1. Install DB Pool log module
2. Configure Openbravo.properties to log threads borrowing more than one connection:
     db.pool.logger.enabled=true
     db.pool.logger.logMultipleConnectionsPerThread=true
3. Open any xmlEngine generated page (ie. Login page)
  -> check logs:
d05203b3 1241669 [http-bio-8080-exec-1] DEBUG reloadXml - XmlEngine 29-11-2001 Initialized
d05203b3 1241680 [http-bio-8080-exec-1] 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.uiTranslation.TextInterfacesData.selectText(TextInterfacesData.java:107)
  org.openbravo.uiTranslation.TranslationUtils.retrieveLabelData(TranslationUtils.java:180)
  org.openbravo.uiTranslation.TranslationUtils.processFormLabels(TranslationUtils.java:33)
  org.openbravo.uiTranslation.TranslationHandler.processTranslations(TranslationHandler.java:216)

d05203b3 1241680 [http-bio-8080-exec-1] WARN org.openbravo.util.db.DBPoolLogger - ** Listing other 1 active connections for this thread in addition to new PooledConnection[org.postgresql.jdbc.PgConnection@54bc2e89] **
d05203b3 1241680 [http-bio-8080-exec-1] WARN org.openbravo.util.db.DBPoolLogger - ===================== ACTIVE - Tue Jun 20 10:48:25 CEST 2017 - 1497948505899 - PooledConnection[org.postgresql.jdbc.PgConnection@1f6a0e8c]
  Thread: http-bio-8080-exec-1
   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)
It is not possible to use a DalConnectionProvider in HttpBaseServlet.init because it is not thread safe and it could be used at the same time from different threads.

A thread safe solution would be to create a new DalConnectionProvider in XmlDocument.print method. The problem is current DalConnectionProvider is not accessible from src-core.
No tags attached.
related to defect 0006360 closed iperdomo Every once in a while (2 hours) the application gets stuck and you have to stop tomcat and restart 
related to defect 0035855 closed alostale many standard requests borrow more than one connection from DB 
Issue History
2017-06-20 11:11alostaleNew Issue
2017-06-20 11:11alostaleAssigned To => platform
2017-06-20 11:11alostaleModules => Core
2017-06-20 11:11alostaleTriggers an Emergency Pack => No
2017-06-20 11:12alostaleRelationship addedrelated to 0006360
2017-06-20 11:13alostaleRelationship addedrelated to 0035855
2017-06-20 11:13alostaleStatusnew => acknowledged
2022-02-01 08:08alostaleAssigned Toplatform => Triage Platform Base

There are no notes attached to this issue.