Weird Error: CLOSE BY CLIENT STACK TRACE
Asked Answered
E

3

22

Hi all I have a web application which use Hibernate to retrieve data in the database. And in the server side some execeptions come out at regular interval. Below is the exception logs.

    16:04:22,227 DEBUG NewPooledConnection:491 - com.mchange.v2.c3p0.impl.NewPooledConnection@ef46613 closed by a client.
    java.lang.Exception: DEBUG -- CLOSE BY CLIENT STACK TRACE
        at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:491)
        at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:191)
        at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:470)
        at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:964)
        at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
    16:09:42,310 DEBUG C3P0PooledConnectionPool:476 - Successfully destroyed PooledConnection: com.mchange.v2.c3p0.impl.NewPooledConnection@32ef0763
    16:09:42,310 DEBUG BasicResourcePool:967 - Successfully destroyed resource: com.mchange.v2.c3p0.impl.NewPooledConnection@32ef0763
    16:09:42,310 DEBUG GooGooStatementCache:319 - ENTER METHOD: closeAll( org.postgresql.jdbc4.Jdbc4Connection@42df0af8 )! -- num_connections: 1

Could anyone helps me with this problem? Thanks a lot!

Eremite answered 6/12, 2011 at 16:21 Comment(0)
S
27

This is the code that triggers this log statement in C3P0:

if ( logger.isLoggable( MLevel.FINEST ) )
  logger.log( MLevel.FINEST, this + " closed by a client.", 
            new Exception("DEBUG -- CLOSE BY CLIENT STACK TRACE") );

Note that:

  1. This is not an exception, the new Exception is used merely to show execution path for debug purposes.

  2. And yes, this is only a debug message (actually, FINEST is the lowest possible level in java.util.logging).

To wrap this up: ignore and tune your logging levels to skip these.

Schaffel answered 6/12, 2011 at 16:30 Comment(3)
Could you please give more details about ignore and tune your logging levels ?Eremite
Sure. Depending on which logging framework you use you need to configure the logging level of com.mchange.v2.c3p0 logger. Documentation how to do this for: Log4J, Logback or java.util.logging.Schaffel
@TomaszNurkiewicz which logger should I use? I use Log4j of Apache, but that doesn't have isLoggable method. I've posted a new question #35763971Wiesbaden
H
0

I found where the error is: I think that it appears when some object calls deliberately

com.mchange.v2.c3p0.ComboPooledDataSource.close

I have configured this class in spring. When I put destroy-method="close" the error appears.

Obviously, I've removed it and the problem is now solved.

Heer answered 6/6, 2013 at 16:35 Comment(0)
A
0
Hibernate connection close work like this way so you no need remove the destroy-method="close".

public synchronized void close() throws SQLException
{
  close(null);
}

private void close(Throwable cause) throws SQLException
{
<--statement-->
if(cause == null)
{
 invalidatingException = NORMAL_CLOSE_PLACEHOLDER;
 if(logger.isLoggable(MLevel.FINEST))
 logger.log(MLevel.FINEST, this + " closed by a client.", new Exception("DEBUG -- CLOSE BY CLIENT STACK TRACE"));
<--statement-->
}
Aut answered 7/3, 2014 at 3:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.