commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <phil.ste...@gmail.com>
Subject Re: [DBCP] Too many connections issue...
Date Thu, 27 Jan 2011 01:04:47 GMT
Does your application hold Statements / Connections for a long time
without using them?  The symptoms below are consistent with the
physical database connection being closed due to inactivity timeout on
the server side.

Phil

On Wed, Jan 26, 2011 at 12:50 PM, Suny kk <suny.kk@gmail.com> wrote:
> Now my application rising following error sometime and sometime working
> perfect, anyone of you ever faced such error?
>
> Caused by:
> com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No
> operations allowed after statement closed.
>
>                at
> sun.reflect.GeneratedConstructorAccessor157.newInstance(Unknown Source)
>
>                at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>
>                at
> java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>
>                at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
>
>                at com.mysql.jdbc.Util.getInstance(Util.java:381)
>
>                at
> com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984)
>
>                at
> com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
>
>                at
> com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
>
>                at
> com.mysql.jdbc.StatementImpl.checkClosed(StatementImpl.java:405)
>
>                at
> com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:3659)
>
>                at
> com.mysql.jdbc.PreparedStatement.setInt(PreparedStatement.java:3616)
>
>                at
> org.apache.commons.dbcp.DelegatingPreparedStatement.setInt(DelegatingPreparedStatement.java:117)
>
>                at
> org.apache.commons.dbcp.DelegatingPreparedStatement.setInt(DelegatingPreparedStatement.java:117)
>
>                at org.hibernate.type.IntegerType.set(IntegerType.java:64)
>
>                at
> org.hibernate.type.NullableType.nullSafeSet(NullableType.java:154)
>
>                at
> org.hibernate.type.NullableType.nullSafeSet(NullableType.java:136)
>
>                at
> org.hibernate.loader.Loader.bindPositionalParameters(Loader.java:1732)
>
>                at
> org.hibernate.loader.Loader.bindParameterValues(Loader.java:1703)
>
>                at
> org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1593)
>
>                at org.hibernate.loader.Loader.doQuery(Loader.java:696)
>
>                at
> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
>
>                at
> org.hibernate.loader.Loader.loadCollection(Loader.java:2019)
>
>                ... 45 more
>
>
> (I'm just to tired to Google this issue therefore posted here. Good Night)
>
> On Wed, Jan 26, 2011 at 5:24 PM, Mark Shifman <mark.shifman@yale.edu> wrote:
>
>> You may want to look at what connections your database thinks are open.
>> In Oracle, from a sql plus command line:
>>
>> select username, program, machine, osuser, logon_time,  sid, serial#
>> from v$session where osuser != 'oracle' order by machine, logon_time;
>>
>> You can also do something similar with mysql but I don't remember the
>> sql.  I suspect all databases have some way to tell which connections
>> are open.
>>
>> You can also watch the number of open connections grow if you haven't
>> appropriately closed the connections.
>>
>> mas
>>
>>
>>
>> On 01/25/2011 08:05 PM, Phil Steitz wrote:
>> > On Tue, Jan 25, 2011 at 4:39 PM, Suny kk <suny.kk@gmail.com> wrote:
>> >> Hi Phil,
>> >>
>> >> Yes, I'm using BasiDataSource well, Is it because of my DBCP settings?
>> >> Remember I got this exception when I started my application on different
>> >> machine with same database.
>> >>
>> >
>> > Well, if the first instance starts and uses the full 500 max
>> > connections, then that could explain why the second instance cannot
>> > get any connections from the database (assuming the database itself
>> > cannot handle more than 500 connections).
>> >
>> > As I said below, the error that you are getting means that when the
>> > application starts the database does not have connections available to
>> > provide to the pool.  You should check and confirm:
>> >
>> > 0) Is the application closing all connections that it opens?  You can
>> > quickly max the pool connections if your code does not return
>> > connections to the pool.  Your configuration allows 500 connections to
>> > be opened by the pool concurrently.  You should observe the actual
>> > database engine connection counts and see if your app is getting near
>> > the max.  Given that you have maxIdle set at 8, if you are hitting
>> > high connection count numbers either you have some very long-running
>> > queries and large load spikes, or your code is abandoning connections
>> > (not closing them).
>> >
>> > 1) Are other applications or processes consuming available database
>> connections?
>> >
>> > Phil
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> > For additional commands, e-mail: user-help@commons.apache.org
>> >
>>
>> --
>>  Mark Shifman MD. Ph.D.
>>  Yale Center for Medical Informatics
>>  Phone (203)737-5219
>>  mark.shifman@yale.edu
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>>
>

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


Mime
View raw message