activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Pederzolli (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AMQ-662) Infinite Loop after message resend
Date Tue, 04 Apr 2006 16:26:09 GMT
    [ https://issues.apache.org/activemq/browse/AMQ-662?page=comments#action_35973 ] 

John Pederzolli commented on AMQ-662:
-------------------------------------


I found what seems to be the source of the infinite loop - in MessageDispatchChannel.java,
in the method dequeueNoWait (line 91):

    public MessageDispatch dequeueNoWait() {
        synchronized (mutex) {
            if (closed || !running || list.isEmpty()) {
                return null;
            }
            return (MessageDispatch) list.removeFirst();
        }
    }

The thread that keeps on spinning has values of closed=false, running=false, and a nonEmpty
list. With those values, a null is returned up to the run() method of ActiveMqSession.java
(line 640), causing it do do nothing and then finally up to ServerSessionImpl.java's run()
method (line 156) where in the finally block the following code that is responsible for breaking
out of the while loop (line 170):

            finally {
                InboundContextSupport.unregister(this);                
                log.debug("run loop end");            
                synchronized (runControlMutex) {
                    // This endpoint may have gone stale due to error
                    if( stale) {
                        runningFlag = false;
                        pool.removeFromPool(this);
                        break;
                    }
                    if( !session.hasUncomsumedMessages() ) {
                        runningFlag = false;
                        pool.returnToPool(this);
                        break;
                    }                
                }

Neither break statement is hit since the endpoint is not stale and it has unconsumed messages
- and the infinite loop begins. 

> Infinite Loop after message resend
> ----------------------------------
>
>          Key: AMQ-662
>          URL: https://issues.apache.org/activemq/browse/AMQ-662
>      Project: ActiveMQ
>         Type: Bug

>   Components: Broker
>     Versions: 4.0 RC1
>  Environment: JDK 1.5
>     Reporter: John Pederzolli
>     Priority: Critical
>  Attachments: activemq.xml, applicationContext.xml
>
>
> when a runtime exception in onMessage the messages are getting rolledback/resent as expected,
however AMQ appears to go into an infinite loop at this point taking up 100% of the CPU. Turning
debug on shows the following repeated:
> ...
> [DEBUG] 2006-03-21 16:55:37,586 - org.apache.activemq.ra.ServerSessionImpl:1 (ServerSessionImpl.java:159)-
run loop start
> [DEBUG] 2006-03-21 16:55:37,586 - org.apache.activemq.ra.ServerSessionImpl:3 (ServerSessionImpl.java:172)-
run loop end
> [DEBUG] 2006-03-21 16:55:37,586 - org.apache.activemq.ra.ServerSessionImpl:22 (ServerSessionImpl.java:172)-
run loop end
> [DEBUG] 2006-03-21 16:55:37,586 - org.apache.activemq.ra.ServerSessionImpl:11 (ServerSessionImpl.java:159)-
run loop start
> [DEBUG] 2006-03-21 16:55:37,586 - org.apache.activemq.ra.ServerSessionImpl:0 (ServerSessionImpl.java:172)-
run loop end
> [DEBUG] 2006-03-21 16:55:37,586 - org.apache.activemq.ra.ServerSessionImpl:17 (ServerSessionImpl.java:172)-
run loop end
> [DEBUG] 2006-03-21 16:55:37,586 - org.apache.activemq.ra.ServerSessionImpl:1 (ServerSessionImpl.java:172)-
run loop end 
> The resend (and resulting infinte loop) was triggered by throwing a RuntimeException
in the onMessage method of the POJO MDB.
> This is being used alongside Spring 1.2.7, Jencks 1.1.1 in a POJO message driven bean
setup. Attached are the configurations producing the error. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message