You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Timothy Bish (JIRA)" <ji...@apache.org> on 2010/11/04 21:18:01 UTC
[jira] Closed: (AMQCPP-325) Failover transport exception can cause
CPU spin
[ https://issues.apache.org/activemq/browse/AMQCPP-325?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Timothy Bish closed AMQCPP-325.
-------------------------------
Resolution: Working as Designed
Code appears to be doing what it was intended to do.
> Failover transport exception can cause CPU spin
> -----------------------------------------------
>
> Key: AMQCPP-325
> URL: https://issues.apache.org/activemq/browse/AMQCPP-325
> Project: ActiveMQ C++ Client
> Issue Type: Bug
> Components: Transports
> Affects Versions: 3.2.3
> Environment: Windows 2003, Windows 7, Windows XP
> Reporter: FangYu
> Assignee: Timothy Bish
> Original Estimate: 2 weeks
> Remaining Estimate: 2 weeks
>
> We find that when use the failover transport to connect the broker, if failed to connect, then the thread will not release and become a DEADLESS LOOP cause CPU spin.
> See the source code:
> file: ~\activemq-cpp-library-3.2.3\src\main\activemq\transport\failover\failovertransport.cpp
> 500 bool FailoverTransport::iterate() {
> ......................................................................
> 510 if( connectedTransport != NULL || closed || connectionFailure != NULL ) {
> 511 return false;
> ......................................................................
> 702 }
> file: ~\activemq-cpp-library-3.2.3\src\main\activemq\threads\compositetaskrunner.cpp
> 97 void CompositeTaskRunner::run() {
> 98
> 99 try {
> 100
> 101 while( true ) {
> 102
> 103 synchronized( &mutex ) {
> 104 pending = false;
> 105 if( shutDown ) {
> 106 return;
> 107 }
> 108 }
> 109
> 110 if( !this->iterate() ) {
> 111
> 112 // wait to be notified.
> 113 synchronized( &mutex ) {
> 114 if( shutDown ) {
> 115 return;
> 116 }
> 117 while( !pending ) {
> 118 mutex.wait();
> 119 }
> 120 }
> 121 }
> 122 }
> 123 }
> 124 AMQ_CATCH_NOTHROW( Exception )
> 125 AMQ_CATCHALL_NOTHROW()
> 126
> 127 // Make sure we notify any waiting threads that thread
> 128 // has terminated.
> 129 synchronized( &mutex ) {
> 130 threadTerminated = true;
> 131 mutex.notifyAll();
> 132 }
> 133 }
> ............................................................................
> 160 bool CompositeTaskRunner::iterate() {
> 161
> 162 synchronized( &tasks ) {
> 163
> 164 auto_ptr< Iterator<CompositeTask*> > iter( tasks.iterator() );
> 165
> 166 while( iter->hasNext() ) {
> 167
> 168 CompositeTask* task = iter->next();
> 169
> 170 if( task->isPending() ) {
> 171 task->iterate() ;
> 173
> 174 // Always return true, so that we check again for
> 175 // any of the other tasks that might now be pending.
> 176 return true;
> 177 }
> 178 }
> 179 }
> 180
> 181 return false;
> 182 }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.