iBATIS uses auto transaction semantics if you do not explicitly specify
them, so maxTransactions="5" limits the amount of concurrent
transactions to 5, maxSessions="10" also does not seem to be enough. Try
increasing the values, this is most definitely not a deadlock.

Niels

-----Original Message-----
From: class acts [mailto:[EMAIL PROTECTED] 
Sent: maandag 13 november 2006 20:45
To: user-java@ibatis.apache.org
Subject: Re: queryForObject deadlock with high concurrent calls

Hi, thanks for the prompt replies.  I attached a stack-dump, hopefully
it helps.  Not quite sure what is going on.  I'm not used to iBATIS'
patterns so perhaps I may be using it incorrectly.  The app is a TCP
server app, that in this case executes a queryForObject() then a
.update() for each connection to the server.  I can connect about 35
connections a second, its taking between 50ms and 150ms for each
connections-life (ie, to exec the 2 statements) but it seems that if i
do a lot at once, all the threads handling the connections and trying
to execute the sql queries just hang..  usually at the driver level, I
would have a timeout and keep trying to obtain a connection, or
explicitly fail.  here is a sample of how im using the ibatis, I know
it probably should be done as a transaction, but it's not important at
this point, and it also seems to slow it down.

try {
User user = (User)sqlMap.queryForObject("getUserByUsername", username);
                        
// update user object...

sqlMap.update("updateLoginStats", user);
                                        
// more stuff
                                
                        
} catch (SQLException e1) {
log.fatal(client+" Error handling query", e1);
}


Here is a snippet of my config:

<settings cacheModelsEnabled="true" enhancementEnabled="true"
                lazyLoadingEnabled="true" maxRequests="32"
maxSessions="10"
                maxTransactions="5" useStatementNamespaces="false"/>

<transactionManager type="JDBC">
                <dataSource type="SIMPLE">
                        <property name="JDBC.Driver"
value="org.postgresql.Driver"/>
                        <property name="JDBC.ConnectionURL"
value="jdbc:postgresql://127.0.0.1:5432/testdb"/>
                        <property name="JDBC.Username" value="xxx"/>
                        <property name="JDBC.Password" value="xxx"/>
                        <property name="Pool.TimeToWait" value="5000"/>
                </dataSource>
        </transactionManager>

<snip>

Reply via email to