Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
3.2.3
-
None
-
None
-
Windows 2003, Windows 7, Windows XP
Description
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 )
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 )
108 }
109
110 if( !this->iterate() ) {
111
112 // wait to be notified.
113 synchronized( &mutex ) {
114 if( shutDown )
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 )
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() )
178 }
179 }
180
181 return false;
182 }