ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Lamey" <cla...@localmatters.com>
Subject RE: Ibatis throttle - possible deadlock (ibatis 2.2, 2.3)
Date Sat, 12 Jan 2008 20:14:12 GMT
Hmm...the default for Spring is to have no transaction management and Tomcat doesn't have any
either...

Lots of people use iBATIS in high availability situations and don't hit this problem, so there's
something with your setup or code that's causing the issue.

Could you possibly have an old iBATIS jar somewhere - maybe at the common or server level
in Tomcat?

What db and what version?  If it's mysql, which type?

What does the jdbc URL look like?  Are you passing any special arguments via the JDBC URL?

Are you using straight SQL in the SqlMaps or are you using stored procedures?

Are you seeing any locks in the db itself?

You could set the java.sql logging category to DEBUG and then you'd be able to trace which
statements are blocking.  This will generate a lot of logfile data, so be ready for it.

-----Original Message-----
From: Stéphane Hanser [mailto:s.hanser@omegames.com]
Sent: Sat 1/12/2008 2:07 AM
To: user-java@ibatis.apache.org
Subject: Re: Ibatis throttle - possible deadlock (ibatis 2.2, 2.3)
 
Hello,

Yes the app is running on Tomcat 5.5

Here is the spring xml configuration and we aren't using transaction  
anywhere in the app.

    <!-- la source de donnéees DBCP -->
     <bean id="dataSource"  
class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
         <property name="driverClassName" value="$ 
{jdbc.driverClassName}"/>
         <property name="url" value="${jdbc.url}"/>
         <property name="username" value="${jdbc.username}"/>
         <property name="password" value="${jdbc.password}"/>
         <property name="maxActive" value="100"/>
         <property name="maxIdle" value="30"/>
         <property name="maxWait" value="10000"/>
     </bean>

     <!-- SqlMapClient -->
     <bean id="sqlMapClient"
            
class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
         <property name="dataSource" ref="dataSource"/>
         <property name="configLocation">
             <value>classpath:com/omegames/kilometres/dao/ibatis/maps/ 
sql-map-config-mysql.xml</value>
         </property>
     </bean>

Thanks,

Stéphane

Le 12 janv. 08 à 04:03, Chris Lamey a écrit :

> Hello,
>
> Is this running in an app server?
>
> How is the data source wired up to the SqlMapClientTemplate?  Can we  
> see the Spring xml doing this binding?  Are you using declarative  
> transactions anywhere in the app?
>
> Cheers,
> Chris
>
> -----Original Message-----
> From: Stéphane Hanser [mailto:s.hanser@omegames.com]
> Sent: Fri 1/11/2008 6:07 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: https://issues.apache.org/jira/browse/IBATIS-249
> > 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>
> >
> >
>
>
>



Mime
View raw message