Openbravo Issue Tracking System - Retail Modules
View Issue Details
0036290Retail ModulesWeb POSpublic2017-06-20 09:392017-06-27 19:12
alostale 
alostale 
highminorhave not tried
closedfixed 
5
 
RR17Q3 
caristu
No
0036290: WebPOS login borrows 2 connections from DB pool
Whenever a login is done in WebPOS 2 connections are borrowed from DB pool.
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 WebPOS
  -> Check log:
595dbc4c 2017-06-20 09:36:40,353 [http-bio-8181-exec-4] 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.base.secureApp.SeguridadData.isUserRole(SeguridadData.java:232)
  org.openbravo.base.secureApp.LoginUtils.validUserRole(LoginUtils.java:116)
  org.openbravo.base.secureApp.LoginUtils.fillSessionArguments(LoginUtils.java:203)

595dbc4c 2017-06-20 09:36:40,354 [http-bio-8181-exec-4] WARN org.openbravo.util.db.DBPoolLogger - ** Listing other 1 active connections for this thread in addition to new PooledConnection[org.postgresql.jdbc.PgConnection@4c7ec0bb] **
595dbc4c 2017-06-20 09:36:40,354 [http-bio-8181-exec-4] WARN org.openbravo.util.db.DBPoolLogger - ===================== ACTIVE - Tue Jun 20 09:36:40 CEST 2017 - 1497944200327 - PooledConnection[org.postgresql.jdbc.PgConnection@65792d8b]
  Thread: http-bio-8181-exec-4
   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.OBDal.createCriteria(OBDal.java:501)
   org.openbravo.authentication.basic.DefaultAuthenticationManager.checkIfPasswordExpired(DefaultAuthenticationManager.java:229)
   org.openbravo.authentication.basic.DefaultAuthenticationManager.doAuthenticate(DefaultAuthenticationManager.java:163)
   org.openbravo.authentication.AuthenticationManager.authenticate(AuthenticationManager.java:172)


---
[1] http://centralrepository.openbravo.com/openbravo/org.openbravo.forge.ui/sso/ForgeModuleDetail/DB-Pool-Logging-Utilities [^] [^]
Performance
related to defect 0035855 closed alostale Openbravo ERP many standard requests borrow more than one connection from DB 
Issue History
2017-06-20 09:39alostaleNew Issue
2017-06-20 09:39alostaleAssigned To => Retail
2017-06-20 09:39alostaleTriggers an Emergency Pack => No
2017-06-20 09:40alostaleAssigned ToRetail => alostale
2017-06-20 09:40alostaleReview Assigned To => caristu
2017-06-20 09:40alostaleRelationship addedrelated to 0035855
2017-06-20 09:40alostaleTag Attached: Performance
2017-06-20 09:42hgbotCheckin
2017-06-20 09:42hgbotNote Added: 0097501
2017-06-20 09:42hgbotStatusnew => resolved
2017-06-20 09:42hgbotResolutionopen => fixed
2017-06-20 09:42hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/f6e4fcfeafd88d4c02b03a7529091439c485125f [^]
2017-06-27 19:12caristuNote Added: 0097718
2017-06-27 19:12caristuStatusresolved => closed
2017-06-27 19:12caristuFixed in Version => RR17Q3

Notes
(0097501)
hgbot   
2017-06-20 09:42   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: f6e4fcfeafd88d4c02b03a7529091439c485125f
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Tue Jun 20 09:42:07 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/f6e4fcfeafd88d4c02b03a7529091439c485125f [^]

fixed bug 36290: WebPOS login borrows 2 connections from DB pool

  Fixed by re-using DAL's connections instead of getting it from Servlet's
  ConnectionProvider.

---
M src/org/openbravo/mobile/core/login/MobileCoreLoginHandler.java
---
(0097718)
caristu   
2017-06-27 19:12   
Code reviewed + tested OK: LoginUtils.fillSessionArguments does not borrow a second database connection after login.