[ 
https://issues.apache.org/activemq/browse/AMQCPP-174?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Timothy Bish resolved AMQCPP-174.
---------------------------------

      Assignee: Timothy Bish  (was: Nathan Mittler)
    Resolution: Fixed

Made some changes to the session executer that seems to have resolved the 
dedlock issue.  Changes are in SVN rev: 657835

> Deadlock on transacted session
> ------------------------------
>
>                 Key: AMQCPP-174
>                 URL: https://issues.apache.org/activemq/browse/AMQCPP-174
>             Project: ActiveMQ C++ Client
>          Issue Type: Bug
>          Components: CMS Impl
>    Affects Versions: 2.1.3
>         Environment: Windows XP
> Visual Studio 2003 & 2005
> activemq-cpp 2.1.3
> apache-activemq 5.0.0
>            Reporter: Nick Cooper
>            Assignee: Timothy Bish
>             Fix For: 2.2
>
>         Attachments: request_response.zip
>
>
> I am implementing a request/response client and require the ability to do 
> transactions. I initially created one connection with one session with a 
> producer and a consumer. This worked fine when creating the session with 
> Session::AUTO_ACKNOWLEDGE. When I changed this to use 
> Session::SESSION_TRANSACTED
> with session->commit() the application stopped working. To help work out the 
> issue I created separate connections and sessions for the producer and 
> consumer which did not help.
> Looking at the application in the debugger it looks like when 
> session->commit() is called, a dead lock occurs.
> In ActiveMQSessionExecutor::stop()  the following line is executed:
>         // Wakeup the thread so that it can acknowledge the stop request.
>         mutex.notifyAll();
> but eventQ.size() is 0, that is no thread is notified. The next line is then 
> executed:
>         // Wait for the thread to notify us that it has acknowledged
>         // the stop request.
>         mutex.wait();
> but there is no other thread to ever come and wake it up, thus it hangs and 
> the session is never committed.
> Am I using the API incorrectly or is this a real issue?
> Note this looks very similar to issue 155 
> https://issues.apache.org/activemq/browse/AMQCPP-155
> Thread Summary
> --------------
>       2000    main                 tool::DefaultCounter::`scalar deleting 
> destructor' Normal  0
>       1896    _threadstartex  activemq::concurrent::Mutex::wait               
>                Normal   0
>       3984    _threadstartex  activemq::network::SocketInputStream::read      
>            Normal       0
> >     1544    _threadstartex  activemq::concurrent::Mutex::notifyAll          
> >                Normal   0
> Thread 1544 Stacktrace....
> >     ppl_worker_d.exe!activemq::concurrent::Mutex::notifyAll()  Line 233     
> > C++
>       ppl_worker_d.exe!activemq::core::ActiveMQSessionExecutor::stop()  Line 
> 150 + 0x11       C++
>       ppl_worker_d.exe!activemq::core::ActiveMQSession::stop()  Line 847 + 
> 0x1b       C++
>       ppl_worker_d.exe!activemq::core::ActiveMQTransaction::commit()  Line 
> 205        C++
>       ppl_worker_d.exe!activemq::core::ActiveMQSession::commit()  Line 150 + 
> 0x13     C++
>       ppl_worker_d.exe!dist::TransactedConnector::onMessage(const 
> cms::Message * message=0x014df8c0)  Line 176 + 0x30 C++
>       
> ppl_worker_d.exe!activemq::core::ActiveMQConsumer::dispatch(activemq::core::DispatchData
>  & data={...})  Line 429 + 0x3a C++
>       
> ppl_worker_d.exe!activemq::core::ActiveMQSessionExecutor::dispatch(activemq::core::DispatchData
>  & data={...})  Line 188 + 0x15  C++
>       ppl_worker_d.exe!activemq::core::ActiveMQSessionExecutor::dispatchAll() 
>  Line 273 + 0x11        C++
>       ppl_worker_d.exe!activemq::core::ActiveMQSessionExecutor::run()  Line 
> 213       C++
>       ppl_worker_d.exe!activemq::concurrent::Thread::runCallback(void * 
> param=0x014dc3e8)  Line 152 + 0x13    C++
>       msvcr71d.dll!_threadstartex(void * ptd=0x014df798)  Line 241 + 0xd      
> C
>       kernel32.dll!7c80b683()         
> Thread 3984 Stacktrace....
> >     ppl_worker_d.exe!activemq::network::SocketInputStream::read(unsigned 
> > char * buffer=0x014d8f70, unsigned int bufferSize=1)  Line 152 + 0x19      
> > C++
>       ppl_worker_d.exe!activemq::io::BufferedInputStream::bufferData()  Line 
> 190 + 0x2c       C++
>       ppl_worker_d.exe!activemq::io::BufferedInputStream::read(unsigned char 
> * targetBuffer=0x017ff6f4, unsigned int targetBufferSize=4)  Line 125    C++
>       ppl_worker_d.exe!activemq::io::DataInputStream::readAllData(unsigned 
> char * buffer=0x017ff6f4, unsigned int length=4)  Line 369 + 0x21  C++
>       ppl_worker_d.exe!activemq::io::DataInputStream::readInt()  Line 168     
> C++
>       
> ppl_worker_d.exe!activemq::connector::openwire::OpenWireFormat::unmarshal(activemq::io::DataInputStream
>  * dis=0x014dcbe8)  Line 218 + 0xd       C++
>       
> ppl_worker_d.exe!activemq::connector::openwire::OpenWireCommandReader::readCommand()
>   Line 71 + 0x1a    C++
>       ppl_worker_d.exe!activemq::transport::IOTransport::run()  Line 166 + 
> 0x13       C++
>       ppl_worker_d.exe!activemq::concurrent::Thread::runCallback(void * 
> param=0x014dce40)  Line 152 + 0x13    C++
>       msvcr71d.dll!_threadstartex(void * ptd=0x014ddd10)  Line 241 + 0xd      
> C
>       kernel32.dll!7c80b683()         
> Thread 1896 Stacktrace....
> >     ppl_worker_d.exe!activemq::concurrent::Mutex::wait(unsigned long 
> > millisecs=4294967295)  Line 178 + 0x10 C++
>       ppl_worker_d.exe!activemq::concurrent::Mutex::wait()  Line 102 + 0xf    
> C++
>       ppl_worker_d.exe!activemq::util::Queue<activemq::transport::Command 
> *>::wait()  Line 206 + 0x11 C++
>       
> ppl_worker_d.exe!activemq::transport::filters::AsyncSendTransport::run()  
> Line 118 + 0x11       C++
>       ppl_worker_d.exe!activemq::concurrent::Thread::runCallback(void * 
> param=0x014dcad0)  Line 152 + 0x13    C++
>       msvcr71d.dll!_threadstartex(void * ptd=0x014dcd78)  Line 241 + 0xd      
> C
>       kernel32.dll!7c80b683() 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to