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>


test at localhost:4393 (Suspended)      
        System Thread [Attach Listener] (Suspended)     
        System Thread [Signal Dispatcher] (Suspended)   
        System Thread [Finalizer] (Suspended)   
        System Thread [Reference Handler] (Suspended)   
        Thread [SessionScavenger] (Suspended)   
        Thread [Acceptor
ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=2168]] (Suspended)
        Thread [SocketListener0-0] (Suspended)  
        Thread [SocketListener0-1] (Suspended)  
        Thread [PooledByteBufferExpirer-0] (Suspended)  
        Thread [Timer-0] (Suspended)    
        Thread [SocketAcceptor-0] (Suspended)   
        Thread [SocketConnector-1] (Suspended)  
        Thread [DestroyJavaVM] (Suspended)      
        Thread [SocketConnectorIoProcessor-0.0] (Suspended)     
        Thread [Thread-1] (Suspended)   
                Object.wait(long) line: not available [native method]   
                Object.wait() line: 485 [local variables unavailable]   
                Throttle.increment() line: 69   
                ThrottledPool.pop() line: 60    
                SqlMapExecutorDelegate.popSession() line: 910   
                SqlMapSessionImpl.<init>(ExtendedSqlMapClient) line: 50   
                SqlMapClientImpl.getLocalSqlMapSession() line: 214      
                SqlMapClientImpl.queryForObject(String, Object) line: 70        
                PPServerHandlerImpl.auth(PPClient, String, String) line: 270    
                PPIoHandlerAdapterImpl.processPacket(PPClient, AppPacket) line: 
241     
                PPIoHandlerAdapterImpl.messageReceived(IoSession, Object) line: 
164     
                AbstractIoFilterChain$2.messageReceived(IoFilter$NextFilter,
IoSession, Object) line: 189
                
SocketFilterChain(AbstractIoFilterChain).callNextMessageReceived(IoFilterChain$Entry,
IoSession, Object) line: 502
                AbstractIoFilterChain.access$5(AbstractIoFilterChain,
IoFilterChain$Entry, IoSession, Object) line: 496
                AbstractIoFilterChain$EntryImpl$1.messageReceived(IoSession, 
Object)
line: 777
                SimpleProtocolDecoderOutput.flush() line: 60    
                ProtocolCodecFilter.messageReceived(IoFilter$NextFilter, 
IoSession,
Object) line: 185
                
SocketFilterChain(AbstractIoFilterChain).callNextMessageReceived(IoFilterChain$Entry,
IoSession, Object) line: 502
                AbstractIoFilterChain.access$5(AbstractIoFilterChain,
IoFilterChain$Entry, IoSession, Object) line: 496
                AbstractIoFilterChain$EntryImpl$1.messageReceived(IoSession, 
Object)
line: 777
                ExecutorFilter.processEvent(IoFilter$NextFilter, IoSession,
ExecutorFilter$EventType, Object) line: 243
                ExecutorFilter$ProcessEventsRunnable.run() line: 305    
                ThreadPoolExecutor$Worker.runTask(Runnable) line: not available 
                ThreadPoolExecutor$Worker.run() line: not available [local 
variables
unavailable]
                Thread.run() line: not available [local variables unavailable]  
        Thread [Thread-2] (Suspended)   
                Object.wait(long) line: not available [native method]   
                Object.wait() line: 485 [local variables unavailable]   
                Throttle.increment() line: 69   
                ThrottledPool.pop() line: 60    
                SqlMapExecutorDelegate.popSession() line: 910   
                SqlMapSessionImpl.<init>(ExtendedSqlMapClient) line: 50   
                SqlMapClientImpl.getLocalSqlMapSession() line: 214      
                SqlMapClientImpl.queryForObject(String, Object) line: 70        
                PPServerHandlerImpl.auth(PPClient, String, String) line: 270    
                PPIoHandlerAdapterImpl.processPacket(PPClient, AppPacket) line: 
241     
                PPIoHandlerAdapterImpl.messageReceived(IoSession, Object) line: 
164     
                AbstractIoFilterChain$2.messageReceived(IoFilter$NextFilter,
IoSession, Object) line: 189
                
SocketFilterChain(AbstractIoFilterChain).callNextMessageReceived(IoFilterChain$Entry,
IoSession, Object) line: 502
                AbstractIoFilterChain.access$5(AbstractIoFilterChain,
IoFilterChain$Entry, IoSession, Object) line: 496
                AbstractIoFilterChain$EntryImpl$1.messageReceived(IoSession, 
Object)
line: 777
                SimpleProtocolDecoderOutput.flush() line: 60    
                ProtocolCodecFilter.messageReceived(IoFilter$NextFilter, 
IoSession,
Object) line: 185
                
SocketFilterChain(AbstractIoFilterChain).callNextMessageReceived(IoFilterChain$Entry,
IoSession, Object) line: 502
                AbstractIoFilterChain.access$5(AbstractIoFilterChain,
IoFilterChain$Entry, IoSession, Object) line: 496
                AbstractIoFilterChain$EntryImpl$1.messageReceived(IoSession, 
Object)
line: 777
                ExecutorFilter.processEvent(IoFilter$NextFilter, IoSession,
ExecutorFilter$EventType, Object) line: 243
                ExecutorFilter$ProcessEventsRunnable.run() line: 305    
                ThreadPoolExecutor$Worker.runTask(Runnable) line: not available 
                ThreadPoolExecutor$Worker.run() line: not available [local 
variables
unavailable]
                Thread.run() line: not available [local variables unavailable]  
        Thread [Thread-3] (Suspended)   
                Object.wait(long) line: not available [native method]   
                Object.wait() line: 485 [local variables unavailable]   
                Throttle.increment() line: 69   
                ThrottledPool.pop() line: 60    
                SqlMapExecutorDelegate.popSession() line: 910   
                SqlMapSessionImpl.<init>(ExtendedSqlMapClient) line: 50   
                SqlMapClientImpl.getLocalSqlMapSession() line: 214      
                SqlMapClientImpl.queryForObject(String, Object) line: 70        
                PPServerHandlerImpl.auth(PPClient, String, String) line: 270    
                PPIoHandlerAdapterImpl.processPacket(PPClient, AppPacket) line: 
241     
                PPIoHandlerAdapterImpl.messageReceived(IoSession, Object) line: 
164     
                AbstractIoFilterChain$2.messageReceived(IoFilter$NextFilter,
IoSession, Object) line: 189
                
SocketFilterChain(AbstractIoFilterChain).callNextMessageReceived(IoFilterChain$Entry,
IoSession, Object) line: 502
                AbstractIoFilterChain.access$5(AbstractIoFilterChain,
IoFilterChain$Entry, IoSession, Object) line: 496
                AbstractIoFilterChain$EntryImpl$1.messageReceived(IoSession, 
Object)
line: 777
                SimpleProtocolDecoderOutput.flush() line: 60    
                ProtocolCodecFilter.messageReceived(IoFilter$NextFilter, 
IoSession,
Object) line: 185
                
SocketFilterChain(AbstractIoFilterChain).callNextMessageReceived(IoFilterChain$Entry,
IoSession, Object) line: 502
                AbstractIoFilterChain.access$5(AbstractIoFilterChain,
IoFilterChain$Entry, IoSession, Object) line: 496
                AbstractIoFilterChain$EntryImpl$1.messageReceived(IoSession, 
Object)
line: 777
                ExecutorFilter.processEvent(IoFilter$NextFilter, IoSession,
ExecutorFilter$EventType, Object) line: 243
                ExecutorFilter$ProcessEventsRunnable.run() line: 305    
                ThreadPoolExecutor$Worker.runTask(Runnable) line: not available 
                ThreadPoolExecutor$Worker.run() line: not available [local 
variables
unavailable]
                Thread.run() line: not available        
        Thread [Thread-4] (Suspended)   
                Object.wait(long) line: not available [native method]   
                Object.wait() line: 485 [local variables unavailable]   
                Throttle.increment() line: 69   
                ThrottledPool.pop() line: 60    
                SqlMapExecutorDelegate.popSession() line: 910   
                SqlMapSessionImpl.<init>(ExtendedSqlMapClient) line: 50   
                SqlMapClientImpl.getLocalSqlMapSession() line: 214      
                SqlMapClientImpl.queryForObject(String, Object) line: 70        
                PPServerHandlerImpl.auth(PPClient, String, String) line: 270    
                PPIoHandlerAdapterImpl.processPacket(PPClient, AppPacket) line: 
241     
                PPIoHandlerAdapterImpl.messageReceived(IoSession, Object) line: 
164     
                AbstractIoFilterChain$2.messageReceived(IoFilter$NextFilter,
IoSession, Object) line: 189
                
SocketFilterChain(AbstractIoFilterChain).callNextMessageReceived(IoFilterChain$Entry,
IoSession, Object) line: 502
                AbstractIoFilterChain.access$5(AbstractIoFilterChain,
IoFilterChain$Entry, IoSession, Object) line: 496
                AbstractIoFilterChain$EntryImpl$1.messageReceived(IoSession, 
Object)
line: 777
                SimpleProtocolDecoderOutput.flush() line: 60    
                ProtocolCodecFilter.messageReceived(IoFilter$NextFilter, 
IoSession,
Object) line: 185
                
SocketFilterChain(AbstractIoFilterChain).callNextMessageReceived(IoFilterChain$Entry,
IoSession, Object) line: 502
                AbstractIoFilterChain.access$5(AbstractIoFilterChain,
IoFilterChain$Entry, IoSession, Object) line: 496
                AbstractIoFilterChain$EntryImpl$1.messageReceived(IoSession, 
Object)
line: 777
                ExecutorFilter.processEvent(IoFilter$NextFilter, IoSession,
ExecutorFilter$EventType, Object) line: 243
                ExecutorFilter$ProcessEventsRunnable.run() line: 305    
                ThreadPoolExecutor$Worker.runTask(Runnable) line: not available 
                ThreadPoolExecutor$Worker.run() line: not available     
                Thread.run() line: not available        
        Thread [Thread-5] (Suspended)   
                Object.wait(long) line: not available [native method]   
                Object.wait() line: 485 [local variables unavailable]   
                Throttle.increment() line: 69   
                ThrottledPool.pop() line: 60    
                SqlMapExecutorDelegate.popSession() line: 910   
                SqlMapSessionImpl.<init>(ExtendedSqlMapClient) line: 50   
                SqlMapClientImpl.getLocalSqlMapSession() line: 214      
                SqlMapClientImpl.queryForObject(String, Object) line: 70        
                PPServerHandlerImpl.auth(PPClient, String, String) line: 270    
                PPIoHandlerAdapterImpl.processPacket(PPClient, AppPacket) line: 
241     
                PPIoHandlerAdapterImpl.messageReceived(IoSession, Object) line: 
164     
                AbstractIoFilterChain$2.messageReceived(IoFilter$NextFilter,
IoSession, Object) line: 189
                
SocketFilterChain(AbstractIoFilterChain).callNextMessageReceived(IoFilterChain$Entry,
IoSession, Object) line: 502
                AbstractIoFilterChain.access$5(AbstractIoFilterChain,
IoFilterChain$Entry, IoSession, Object) line: 496
                AbstractIoFilterChain$EntryImpl$1.messageReceived(IoSession, 
Object)
line: 777
                SimpleProtocolDecoderOutput.flush() line: 60    
                ProtocolCodecFilter.messageReceived(IoFilter$NextFilter, 
IoSession,
Object) line: 185
                
SocketFilterChain(AbstractIoFilterChain).callNextMessageReceived(IoFilterChain$Entry,
IoSession, Object) line: 502
                AbstractIoFilterChain.access$5(AbstractIoFilterChain,
IoFilterChain$Entry, IoSession, Object) line: 496
                AbstractIoFilterChain$EntryImpl$1.messageReceived(IoSession, 
Object)
line: 777
                ExecutorFilter.processEvent(IoFilter$NextFilter, IoSession,
ExecutorFilter$EventType, Object) line: 243
                ExecutorFilter$ProcessEventsRunnable.run() line: 305    
                ThreadPoolExecutor$Worker.runTask(Runnable) line: not available 
                ThreadPoolExecutor$Worker.run() line: not available [local 
variables
unavailable]
                Thread.run() line: not available [local variables unavailable]  
        Thread [Thread-6] (Suspended)   
                Object.wait(long) line: not available [native method]   
                Object.wait() line: 485 [local variables unavailable]   
                Throttle.increment() line: 69   
                ThrottledPool.pop() line: 60    
                SqlMapExecutorDelegate.popSession() line: 910   
                SqlMapSessionImpl.<init>(ExtendedSqlMapClient) line: 50   
                SqlMapClientImpl.getLocalSqlMapSession() line: 214      
                SqlMapClientImpl.queryForObject(String, Object) line: 70        
                PPServerHandlerImpl.auth(PPClient, String, String) line: 270    
                PPIoHandlerAdapterImpl.processPacket(PPClient, AppPacket) line: 
241     
                PPIoHandlerAdapterImpl.messageReceived(IoSession, Object) line: 
164     
                AbstractIoFilterChain$2.messageReceived(IoFilter$NextFilter,
IoSession, Object) line: 189
                
SocketFilterChain(AbstractIoFilterChain).callNextMessageReceived(IoFilterChain$Entry,
IoSession, Object) line: 502
                AbstractIoFilterChain.access$5(AbstractIoFilterChain,
IoFilterChain$Entry, IoSession, Object) line: 496
                AbstractIoFilterChain$EntryImpl$1.messageReceived(IoSession, 
Object)
line: 777
                SimpleProtocolDecoderOutput.flush() line: 60    
                ProtocolCodecFilter.messageReceived(IoFilter$NextFilter, 
IoSession,
Object) line: 185
                
SocketFilterChain(AbstractIoFilterChain).callNextMessageReceived(IoFilterChain$Entry,
IoSession, Object) line: 502
                AbstractIoFilterChain.access$5(AbstractIoFilterChain,
IoFilterChain$Entry, IoSession, Object) line: 496
                AbstractIoFilterChain$EntryImpl$1.messageReceived(IoSession, 
Object)
line: 777
                ExecutorFilter.processEvent(IoFilter$NextFilter, IoSession,
ExecutorFilter$EventType, Object) line: 243
                ExecutorFilter$ProcessEventsRunnable.run() line: 305    
                ThreadPoolExecutor$Worker.runTask(Runnable) line: not available 
                ThreadPoolExecutor$Worker.run() line: not available [local 
variables
unavailable]
                Thread.run() line: not available [local variables unavailable]  
        Thread [Thread-7] (Suspended)   
                Object.wait(long) line: not available [native method]   
                Object.wait() line: 485 
                Throttle.increment() line: 69   
                ThrottledPool.pop() line: 60    
                SqlMapExecutorDelegate.popSession() line: 910   
                SqlMapSessionImpl.<init>(ExtendedSqlMapClient) line: 50   
                SqlMapClientImpl.getLocalSqlMapSession() line: 214      
                SqlMapClientImpl.queryForObject(String, Object) line: 70        
                PPServerHandlerImpl.auth(PPClient, String, String) line: 270    
                PPIoHandlerAdapterImpl.processPacket(PPClient, AppPacket) line: 
241     
                PPIoHandlerAdapterImpl.messageReceived(IoSession, Object) line: 
164     
                AbstractIoFilterChain$2.messageReceived(IoFilter$NextFilter,
IoSession, Object) line: 189
                
SocketFilterChain(AbstractIoFilterChain).callNextMessageReceived(IoFilterChain$Entry,
IoSession, Object) line: 502
                AbstractIoFilterChain.access$5(AbstractIoFilterChain,
IoFilterChain$Entry, IoSession, Object) line: 496
                AbstractIoFilterChain$EntryImpl$1.messageReceived(IoSession, 
Object)
line: 777
                SimpleProtocolDecoderOutput.flush() line: 60    
                ProtocolCodecFilter.messageReceived(IoFilter$NextFilter, 
IoSession,
Object) line: 185
                
SocketFilterChain(AbstractIoFilterChain).callNextMessageReceived(IoFilterChain$Entry,
IoSession, Object) line: 502
                AbstractIoFilterChain.access$5(AbstractIoFilterChain,
IoFilterChain$Entry, IoSession, Object) line: 496
                AbstractIoFilterChain$EntryImpl$1.messageReceived(IoSession, 
Object)
line: 777
                ExecutorFilter.processEvent(IoFilter$NextFilter, IoSession,
ExecutorFilter$EventType, Object) line: 243
                ExecutorFilter$ProcessEventsRunnable.run() line: 305    
                ThreadPoolExecutor$Worker.runTask(Runnable) line: not available 
                ThreadPoolExecutor$Worker.run() line: not available     
                Thread.run() line: not available        
        Thread [Thread-8] (Suspended)   
        Thread [Thread-9] (Suspended)   
        Thread [Thread-10] (Suspended)  
        Thread [Thread-11] (Suspended)  
        Thread [Thread-12] (Suspended)  
        Thread [Thread-13] (Suspended)  
        Thread [Thread-14] (Suspended)  
        Thread [Thread-15] (Suspended)  
        Thread [Thread-16] (Suspended)  


On 11/14/06, Niels Beekman <[EMAIL PROTECTED]> wrote:
Check the maxSessions session in your SQLMap config. Also, do you really
mean deadlock? If so, there is something seriously wrong. Maybe you
could do a stack dump, I think it's just contention, not deadlock.

Niels

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

Hi all,

   I'm using Jmeter to create 100 threads that in turn execute
queryForObject on the server side, it seems that if I try to do many
queryForObject calls from many threads concurrently, they all seem to
deadlock at popSession().  I'm using the builtin database pooler,
should I perhaps try using dbcp?  Anyone run into this problem before?
 I wouldn't mind having it timeout after n seconds if it can't execute
the query then I can just keep retrying.  I hardly think postgresql
would like me to increase the concurrent connection count to more than
50 (which I currently have it set at now).

Thanks in advance

Reply via email to