You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Phil Steitz (JIRA)" <ji...@apache.org> on 2014/12/28 00:18:13 UTC
[jira] [Comment Edited] (DBCP-424) validateLifetime causes needless
warnings about swallowed exceptions to be logged
[ https://issues.apache.org/jira/browse/DBCP-424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14259516#comment-14259516 ]
Phil Steitz edited comment on DBCP-424 at 12/27/14 11:18 PM:
-------------------------------------------------------------
I am not sure what the best fix for this is. Here is what is going on. When maxConnLifetimeMillis is set to a positive value, each time a connection is activated or passivated by PoolableConnectionFactory, its age is compared to the configured value and if it is too old, the factory method throws an exception with a message like the one shown in the stack trace. The underlying GenericObjectPool (from Commons pool) swallows exceptions generated by activation/passivation, destroying failed instances instead of returning them to the pool or giving them to clients. The 2.x pools provide a SwallowedExceptionListener interface that clients can use to listen for swallowed exceptions. DBCP listens for and logs these exceptions. A simple fix would be to make the DBCP listening behavior optional; but that could result in other exceptions being silently swallowed.
was (Author: psteitz):
I am not sure what the best fix for this is. Here is what is going on. When maxConnLifetimeMillis is set to a positive value, each time a connection is activated or passivated by PoolableConnectionFactory, it's age is compared to the configured value and if it is too old, the factory method throws an exception with a message like the one shown in the stack trace. The underlying GenericObjectPool (from Commons pool) swallows exceptions generated by activation/passivation, destroying failed instances instead of returning them to the pool or giving them to clients. The 2.x pools provide a SwallowedExceptionListener interface that clients can use to listen for swallowed exceptions. DBCP listens for and logs these exceptions. A simple fix would be to make the DBCP listening behavior optional; but that could result in other exceptions being silently swallowed.
> validateLifetime causes needless warnings about swallowed exceptions to be logged
> ---------------------------------------------------------------------------------
>
> Key: DBCP-424
> URL: https://issues.apache.org/jira/browse/DBCP-424
> Project: Commons Dbcp
> Issue Type: Improvement
> Affects Versions: 2.0
> Environment: Java 1.7, jTDS 1.2.8, Ubuntu Linux 12.04
> Reporter: Eric Fialkowski
> Priority: Minor
> Fix For: 2.1
>
>
> the validateLifetime method in PoolableConnectionFactory is causing the following warning to be logged, even though it is not an exceptional case. While it is not impairing functionality, we have to work around the issue.
> 2014-07-29 14:15:28.0573 WARN http-8084-52 org.apache.commons.dbcp2.BasicDataSource An internal object pool swallowed an Exception
> java.lang.Exception: The lifetime of the connection [300,008] milliseconds exceeds the maximum permitted value of [300,000] milliseconds
> at org.apache.commons.dbcp2.PoolableConnectionFactory.validateLifetime(PoolableConnectionFactory.java:370)
> at org.apache.commons.dbcp2.PoolableConnectionFactory.passivateObject(PoolableConnectionFactory.java:310)
> at org.apache.commons.pool2.impl.GenericObjectPool.returnObject(GenericObjectPool.java:577)
> at org.apache.commons.dbcp2.PoolableConnection.close(PoolableConnection.java:171)
> at org.apache.commons.dbcp2.DelegatingConnection.closeInternal(DelegatingConnection.java:235)
> at org.apache.commons.dbcp2.DelegatingConnection.close(DelegatingConnection.java:218)
> at org.apache.commons.dbcp2.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:229)
> at org.springframework.jdbc.datasource.DataSourceUtils.doCloseConnection(DataSourceUtils.java:341)
> at org.springframework.jdbc.datasource.DataSourceUtils.doReleaseConnection(DataSourceUtils.java:328)
> at org.springframework.jdbc.datasource.DataSourceUtils.releaseConnection(DataSourceUtils.java:294)
> at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:417)
> at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:468)
> at org.springframework.jdbc.core.JdbcTemplate.queryForRowSet(JdbcTemplate.java:523)
> at com.ca.vm.lib.dao.ModelDao.loadJobDetails(ModelDao.java:999)
> at com.ca.vm.lib.dao.ModelDao.extractJobs(ModelDao.java:910)
> at com.ca.vm.lib.dao.ModelDao.extractJob(ModelDao.java:921)
> at com.ca.vm.lib.dao.ModelDao.loadJob(ModelDao.java:744)
> at com.ca.vm.api.jobs.JobsApiLinksLoader$1.load(JobsApiLinksLoader.java:48)
> at com.ca.vm.api.json.ApiLinksExpander.makeApiRequest(ApiLinksExpander.java:130)
> at com.ca.vm.api.json.ApiLinksExpander.expand(ApiLinksExpander.java:114)
> at com.ca.vm.api.json.ApiLinksExpander.rootExpand(ApiLinksExpander.java:65)
> at com.ca.vm.api.json.ApiLinksExpander.toJson(ApiLinksExpander.java:60)
> at com.ca.vm.api.JobsResource.getJobById(JobsResource.java:283)
> at sun.reflect.GeneratedMethodAccessor317.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601)
> at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
> at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
> at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
> at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
> at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
> at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
> at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
> at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
> at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511)
> at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
> at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
> at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
> at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
> at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
> at com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:910)
> at com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:858)
> at com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:812)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> at com.ca.graphite.ws.lib.AbstractGraphiteMetricFilter.doFilter(AbstractGraphiteMetricFilter.java:72)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
> at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
> at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
> at java.lang.Thread.run(Thread.java:722)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)