ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clinton Begin" <clinton.be...@gmail.com>
Subject RE: Ibatis throttle - possible deadlock (ibatis 2.2, 2.3)
Date Sat, 12 Jan 2008 05:33:25 GMT
If you're using Spring, then the transaction/session scope is managed
completely by Spring.  Somehow you'll have to verify the same thing I
mentioned, but within the context of Spring... make sure the transactions
are guaranteed to be opened and closed consistently and in a fault tolerant

Also, try building iBATIS from the trunk, just to see what kind of error you
get.  It might help debug it, because the new error will likely be from your
datasource and/or connection.


-----Original Message-----
From: Stéphane Hanser [mailto:s.hanser@omegames.com] 
Sent: January-11-08 6:08 PM
To: user-java@ibatis.apache.org
Subject: Re: Ibatis throttle - possible deadlock (ibatis 2.2, 2.3)

Hi everybody.

I join this discussion because I'm working with Nikolas on this  
project and I'm fighting with this problem as well.
Thank you very much for your answer. However I don't know yet how it  
will help us.
Indeed we never use SqlMapClient but only SqlMapClientTemplate and we  
don't use transaction either.

I agree with you when you says that we're out of connections but this  
is the point. The application behaves as if sessions weren't closed.  
We saw on th MySQL server that there was about as many connections as  
the maxActive parameter. All the connections were in sleep.

We use commons-dbcp for our datasource (BasicDataSource).

What do you think could bring to this kind of behavior?

Thanks a lot

Stéphane Hanser

Le 11 janv. 08 à 22:39, Clinton Begin a écrit :

> It's most likely that somewhere in your code you're not properly  
> ending a
> transaction or closing a session.... Every single SqlMapClient usage  
> should
> be wrapped with something like this (unless you're not using a  
> transaction
> at all):
> try {
>  // start
>  // work
>  // commit
> } finally {
>  // end
> }
> Incidentally, if you want to grab the latest source from the trunk  
> and build
> it (simple to do), I've completely removed all of the pooled  
> scopes.  While
> this likely won't solve your problem, the stack trace will likely  
> point you
> to your datasouce and it will appear instead as though you're  
> running out of
> connections (unless you're using our simpledatasource, in which case  
> the
> connections will be forcefully reclaimed and you may never know  
> about the
> problem).
> I'd do a thorough check of all  SqlMapClient usages and make sure  
> they're in
> try/finally blocks and that there is exactly the same number of  
> starts as
> there are ends... (global text search can usually do this fairly  
> easily).
> Clinton
> -----Original Message-----
> From: Nikolas Kyriazopoulos Panagiotopoulos [mailto:nikolaskp@gmail.com 
> ]
> Sent: January-11-08 8:41 AM
> To: user-java@ibatis.apache.org
> Subject: Re: Ibatis throttle - possible deadlock (ibatis 2.2, 2.3)
> [I resend this message because I hadn't confirmed the subscription to
> the list before sending. Sorry for all those that might receive it
> twice]
> Hello,
> I would like to bring this:
> into attention.
> It seems that either an old problem is resurging (not really solved),
> or that we have some configuration problems, so I would  appreciate
> your help.
> Every hour (approximately), suddenly, without a gradual increase in
> thread count etc, a deadlock(?) suddenly rises the charge in our web
> application and within seconds, the application is dead.
> We tend to see threads like the following through jconsole when this
> happens:
> Name: TP-Processor431
> State: WAITING on java.lang.Object@253e7f
> Total blocked: 4 388 Total waited: 248
> Stack trace:
> java.lang.Object.wait(Native Method)
> java.lang.Object.wait(Object.java:474)
> com.ibatis.common.util.Throttle.increment(Throttle.java:70)
> com.ibatis.common.util.ThrottledPool.pop(ThrottledPool.java:57)
> com 
> .ibatis 
> .sqlmap.engine.impl.SqlMapExecutorDelegate.popSession(SqlMapExecut
> orDelegate.java:930)
> com 
> .ibatis 
> .sqlmap.engine.impl.SqlMapSessionImpl.<init>(SqlMapSessionImpl.jav
> a:51)
> com 
> .ibatis 
> .sqlmap.engine.impl.SqlMapClientImpl.getLocalSqlMapSession(SqlMapC
> lientImpl.java:258)
> The database configuration is like this in our Spring 2.5.1
> configuration files, for approximately 1000 connected users:
>   <bean id="dataSource"
> class="org.apache.commons.dbcp.BasicDataSource"
> destroy-method="close">
>      [..]
>       <property name="maxActive" value="100"/>
>       <property name="maxIdle" value="30"/>
>       <property name="maxWait" value="10000"/>
>   </bean>

View raw message