Openbravo Issue Tracking System - Openbravo ERP |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0023882 | Openbravo ERP | A. Platform | public | 2013-05-22 11:43 | 2017-03-15 20:20 |
|
Reporter | alostale | |
Assigned To | alostale | |
Priority | high | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | |
Platform | | OS | 5 | OS Version | |
Product Version | | |
Target Version | | Fixed in Version | 3.0PR17Q2 | |
Merge Request Status | |
Review Assigned To | caristu |
OBNetwork customer | |
Web browser | |
Modules | Core |
Support ticket | |
Regression level | |
Regression date | |
Regression introduced in release | |
Regression introduced by commit | |
Triggers an Emergency Pack | No |
|
Summary | 0023882: 2 dangling DB connections after Tomcat start |
Description | During the Tomcat startup process 2 connections are created in database which are never released to the pool, so they are kept forever consuming some resources. |
Steps To Reproduce | * Using pg9 (just to better monitor)
* Ensure there are no scheduled background processes
* Close all browsers and restart Tomcat
* Check connections (select * from pg_stat_activity): 2 connections are opened
* Operate the application for a while. Check the 2 connections that were present at the beginning are still there, the last query executed for each of them and their state change time have not been modified, this means they are not reused.
select state_change, substr(query,0,100) from pg_stat_activity where state = 'idle' order by state_change;
state_change | substr
-------------------------------+-----------------------------------------------------------------------------------------------------
2015-10-28 14:52:25.521975+00 | SET extra_float_digits = 3
2015-10-28 14:52:40.112256+00 | UPDATE AD_SYSTEM_INFO SET SYSTEM_STATUS = $1
2015-11-11 10:07:02.736565+00 | UPDATE AD_Session SET SESSION_ACTIVE = 'N' WHERE AD_Session.AD_Session_ID =
2015-11-11 10:09:10.412948+00 | SELECT AD_AVAILABLE_UPDATE_ID, ISACTIVE, COMPONENT, OPTION_NAME, OPTION_VERSION, DESCRIPTION, U
2015-11-11 10:10:46.469835+00 | COMMIT
(5 rows)
|
Proposed Solution | |
Additional Information | |
Tags | Performance |
Relationships | duplicate of | defect | 0036274 | | closed | alostale | abandoned connection in SessionListener | related to | defect | 0023818 | 3.0MP24 | closed | alostale | Background scheduler takes 10 connections to database and never releases those | related to | defect | 0035356 | | closed | caristu | print & attach doc logs error using (old) commons jdbc pool | related to | defect | 0036001 | | closed | alostale | Connection leak after start the system having any servlet with "loaded-on-startup" for example: Analytics module installed |
|
Attached Files | |
|
Issue History |
Date Modified | Username | Field | Change |
2013-05-22 11:43 | alostale | New Issue | |
2013-05-22 11:43 | alostale | Assigned To | => alostale |
2013-05-22 11:43 | alostale | Modules | => Core |
2013-05-22 11:43 | alostale | Triggers an Emergency Pack | => No |
2013-05-22 11:43 | alostale | Relationship added | related to 0023818 |
2013-05-22 11:44 | alostale | Tag Attached: Performance | |
2015-03-17 14:38 | alostale | Assigned To | alostale => platform |
2015-11-11 11:11 | alostale | Summary | 3 dangling DB connections after Tomcat start => 2 dangling DB connections after Tomcat start |
2015-11-11 11:11 | alostale | Description Updated | bug_revision_view_page.php?rev_id=10149#r10149 |
2015-11-11 11:11 | alostale | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=10151#r10151 |
2015-11-11 11:12 | alostale | Status | new => acknowledged |
2016-12-01 14:05 | alostale | Priority | normal => urgent |
2016-12-01 14:05 | alostale | Priority | urgent => high |
2017-02-27 10:22 | caristu | Relationship added | related to 0035356 |
2017-03-01 18:05 | shuehner | Note Added: 0094669 | |
2017-03-02 15:50 | alostale | Assigned To | platform => alostale |
2017-03-02 15:50 | alostale | Review Assigned To | => caristu |
2017-03-02 15:51 | hgbot | Checkin | |
2017-03-02 15:51 | hgbot | Note Added: 0094689 | |
2017-03-02 15:51 | hgbot | Checkin | |
2017-03-02 15:51 | hgbot | Note Added: 0094690 | |
2017-03-02 15:51 | hgbot | Status | acknowledged => resolved |
2017-03-02 15:51 | hgbot | Resolution | open => fixed |
2017-03-02 15:51 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/devel/pi/rev/9534e8e498fde6508ff2bf5988fd05a7da0c3bf2 [^] |
2017-03-10 13:37 | caristu | Note Added: 0094916 | |
2017-03-10 13:37 | caristu | Status | resolved => closed |
2017-03-10 13:37 | caristu | Fixed in Version | => 3.0PR17Q2 |
2017-03-15 20:20 | hudsonbot | Checkin | |
2017-03-15 20:20 | hudsonbot | Note Added: 0095251 | |
2017-03-15 20:20 | hudsonbot | Checkin | |
2017-03-15 20:20 | hudsonbot | Note Added: 0095252 | |
2017-05-19 08:06 | caristu | Relationship added | related to 0036001 |
2017-06-19 15:07 | alostale | Relationship added | duplicate of 0036274 |
Notes |
|
|
Possible related stacktrace:
Looks like 3rd line of the connections list mentioned in the issue above.
Mar 01, 2017 4:12:47 PM org.apache.tomcat.jdbc.pool.ConnectionPool suspect
WARNING: Connection has been marked suspect, possibly abandoned PooledConnection[org.postgresql.jdbc.PgConnection@7c9c
at org.apache.tomcat.jdbc.pool.ConnectionPool.getThreadDump(ConnectionPool.java:1075)
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:781)
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:632)
at org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:189)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:128)
at org.openbravo.apachejdbcconnectionpool.JdbcExternalConnectionPool.getConnection(JdbcExternalConnectionPool.
at org.openbravo.database.ConnectionProviderImpl.getNewConnection(ConnectionProviderImpl.java:263)
at org.openbravo.database.ConnectionProviderImpl.getConnection(ConnectionProviderImpl.java:236)
at org.openbravo.database.ConnectionProviderImpl.getPreparedStatement(ConnectionProviderImpl.java:377)
at org.openbravo.database.ConnectionProviderImpl.getPreparedStatement(ConnectionProviderImpl.java:369)
at org.openbravo.erpCommon.security.SessionLoginData.deactivateExpiredSessions(SessionLoginData.java:116)
at org.openbravo.erpCommon.security.SessionListener.contextInitialized(SessionListener.java:127)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5010)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5504)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1229)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745) |
|
|
(0094689)
|
hgbot
|
2017-03-02 15:51
|
|
Repository: erp/devel/pi
Changeset: 8acdcdf44a93ae83625052ab798b447701332d52
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Thu Mar 02 15:46:12 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/8acdcdf44a93ae83625052ab798b447701332d52 [^]
related to bug 23882: 2 dangling DB connections after Tomcat start
One of those leaked connections was used on Tomcat startup by context listeners
using sqlc, the connection was attached to current thread in SessionInfo but
never released to pool because this thread is not managed by DalThreadHandler.
Fixed by manually removing connection from thread after listener execution.
---
M src/org/openbravo/base/SystemStatusListener.java
M src/org/openbravo/erpCommon/security/SessionListener.java
---
|
|
|
(0094690)
|
hgbot
|
2017-03-02 15:51
|
|
Repository: erp/devel/pi
Changeset: 9534e8e498fde6508ff2bf5988fd05a7da0c3bf2
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Thu Mar 02 15:49:51 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/9534e8e498fde6508ff2bf5988fd05a7da0c3bf2 [^]
fixed bug 23882: 2 dangling DB connections after Tomcat start
When Hibernate session factory is initialized, it creates a pool that is not
used when working with Tomcat pool, one connection was retained in this pool.
Now this pool is clean up so that the connection is freed.
Note this pool is still used when working with old commons dbcp pool, even
close method is invoked on the pool instance, it's actually only cleaning up
the connections it might have, so it is still usable.
---
M src/org/openbravo/base/session/SessionFactoryController.java
---
|
|
|
|
Code reviewed + tested OK. |
|
|
|
|
|
|
|