commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tra...@spaceprogram.com
Subject RE: Re: [DBCP] Strange Problems and Errors
Date Wed, 02 Apr 2003 02:32:28 GMT
I just went through the code and within the function that uses this, there is 
pool.getConnection();

Then at the end of the function:

finally {// clean up
            if (conn != null) {
                try {
                    conn.close();
                }
                catch (SQLException e) {
                    System.out.println("IN FINALLY - END of requestprocessor");
                    e.printStackTrace();
                }
            }
        }

That is the only place that the pool is being used.  It is one long function used to process
a request and track it, for ( http://www.ecommstats.com ).  This is fairly heavily hit though,
how well does DBCP perform under pressure?

Travis

---- Original Message ----
From: Rodney Waldhoff <rwaldhoff@apache.org>
Sent: 2003-04-01
To: Jakarta Commons Users List <commons-user@jakarta.apache.org>
Subject: Re: [DBCP] Strange Problems and Errors

The negative getNumActive() result suggests you're returning more
connections than you borrow (e.g., returning the same connection mulitple
times.)  You might try changing the return method to print a stack trace
when the active count goes negative, to try to identify where this might
be happening.

This may or may not account for the NPE you see, but it seems like it
could (e.g., you're now dealing with multiple references to the same
connection, and one for those references was evicted and therefore closed
(and released).)

On Tue, 1 Apr 2003 travis@spaceprogram.com wrote:

> Ok, I'm getting some strange behaviour with dbcp as detailed below:
>
> Here is the config for it:
>
> connectionPool = new GenericObjectPool(null);
>        connectionPool.setMaxActive(50);
>
>        connectionPool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_GROW);
>        connectionPool.setMaxIdle(50);
>        connectionPool.setNumTestsPerEvictionRun(5);
>        connectionPool.setTestWhileIdle(true);
>        connectionPool.setTimeBetweenEvictionRunsMillis(20000);
>        connectionPool.setTestOnBorrow(true);
>        connectionPool.setTestOnReturn(false);
>        connectionPool.setMinEvictableIdleTimeMillis(-1);
>
>        DriverManagerConnectionFactory connectionFactory = new DriverManagerConnectionFactory(dbUrl,
props);
>        PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory,connectionPool,null,null,false,true);
>        pool = new PoolingDataSource(connectionPool);
>
>
> And I am getting this error every couple of minutes:
>
> java.lang.NullPointerException
>        at com.mysql.jdbc.Connection.execSQL(Unknown Source)
>        at com.mysql.jdbc.Connection.execSQL(Unknown Source)
>        at com.mysql.jdbc.Connection.setAutoCommit(Unknown Source)
>        at org.apache.commons.dbcp.DelegatingConnection.setAutoCommit(DelegatingConnection.java:237)
>        at org.apache.commons.dbcp.PoolableConnectionFactory.activateObject(PoolableConnectionFactory.java$
>        at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(Unknown Source)
>        at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:110)
>
>
> Also, when I check pool.getNumActive(); it returns: -7580 .
>
> Idle looks alright though.  Any help would be appreciated cuase it seems that every so
often, users are getitng this error (== bad), then you refresh and the error is gone.
>
> Thanks in advance
>
> Travis Reeder
> Space Program
> http://www.spaceprogram.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org



Mime
View raw message