You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Carl Allain (JIRA)" <ji...@apache.org> on 2009/10/09 01:49:52 UTC

[jira] Created: (AMQ-2446) Client hangs on receive call with timeout value > 0 when activemq is shutdown (CTRL-C)

Client hangs on receive call with timeout value > 0 when activemq is shutdown (CTRL-C)
--------------------------------------------------------------------------------------

                 Key: AMQ-2446
                 URL: https://issues.apache.org/activemq/browse/AMQ-2446
             Project: ActiveMQ
          Issue Type: Bug
    Affects Versions: 5.2.0
         Environment: Windows XP SP3, ActiveMQ 5.2, prefetchSize=0 (java.naming.provider.url = tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=0)
            Reporter: Carl Allain


Start ActiveMQ

create a message consumer and make a receive(30000) call for example.

stop ActiveMQ (CTRL-C)

There is an error reported on the console:

2009-10-08 19:23:54,978 [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616] DEBUG org.apache.activemq.ActiveMQConnection - Async exception with no exception listener: java.io.EOFException
java.io.EOFException
	at java.io.DataInputStream.readInt(DataInputStream.java:358)
	at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:269)
	at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:210)
	at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:202)
	at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:185)
	at java.lang.Thread.run(Thread.java:595)
2009-10-08 19:23:54,978 [ActiveMQ Connection Worker: tcp://localhost/127.0.0.1:61616] DEBUG org.apache.activemq.transport.tcp.TcpTransport - Stopping transport tcp://localhost/127.0.0.1:61616

The thread making the receive call is waiting on a mutex that the ActiveMQ Connection Worker thread that reported that log has (I guess):

class MessageDispatchChannel
    public MessageDispatch dequeue(long timeout) throws InterruptedException {
        synchronized (mutex) {
            // Wait until the consumer is ready to deliver messages.
            while (timeout != 0 && !closed && (list.isEmpty() || !running)) {
                if (timeout == -1) {
                    mutex.wait(); <-----------------------------------------------------------
                } else {
                    mutex.wait(timeout);
                    break;
                }
            }
            if (closed || !running || list.isEmpty()) {
                return null;
            }
            return list.removeFirst();
        }
    }

What is also strange to me is that my timeout of 30000 ms is silently converted to an infinite timeout if the preFetchSize == 0 by this code? Why?

class ActiveMQMessageConsumer
...
            MessageDispatch md;
            if (info.getPrefetchSize() == 0) {
                md = dequeue(-1); // We let the broker let us know when we
                // timeout.
            } else {
                md = dequeue(timeout);
            }


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


[jira] Commented: (AMQ-2446) Client hangs on receive call with timeout value > 0 when activemq is shutdown (CTRL-C)

Posted by "Carl Allain (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=54701#action_54701 ] 

Carl Allain commented on AMQ-2446:
----------------------------------

Good news! I wrote down the simplest test case I could come with:

import java.util.Properties;

import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.MessageConsumer;
import javax.jms.Session;
import javax.naming.Context;
import javax.naming.InitialContext;

public class TestActiveMQShutdown {

    /**
     * Start ActiveMQ on default port
     * Run the main program, it will make a receive with a timeout of 30 seconds
     * During that time, shutdown ActiveMQ.  
     * The system.out below will never happen and you will need to kill the java process
     */
    public static void main(String[] args) throws Exception {

        Properties props = new Properties();
        props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
        // Please not the prefetch policy here
        props.put(Context.PROVIDER_URL, "tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=0");
        props.put("queue.test1", "test1.q");

        InitialContext initialContext = new javax.naming.InitialContext(props);

        ConnectionFactory connectionFactory = (ConnectionFactory) initialContext.lookup("ConnectionFactory");

        Connection connection = (Connection) connectionFactory.createConnection();

        Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);

        Destination destination = (Destination) initialContext.lookup("test1");

        MessageConsumer messageConsumer = session.createConsumer(destination);

        messageConsumer.receive(30000);

        System.out.println("Will never get there if ActiveMQ is shutdown while we were in the receive call above");

        // I don't care about closing all resources in that test and about the message received

    }

}

And with that, I can reproduce the problem in 5.2 (using activemq-all-5.2.0.jar) , but not in 5.3 (using activemq-all-5.3.0.jar). I used jms-1.1.jar in both cases.

I must have made a mistake or something with my full application when I tried to modify. If you guys can confirm that my test case works for you too, reproducing the problem in 5.2 and seeing 5.3 fixes it, the we could all vote for 5.3 RC4!


> Client hangs on receive call with timeout value > 0 when activemq is shutdown (CTRL-C)
> --------------------------------------------------------------------------------------
>
>                 Key: AMQ-2446
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2446
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.2.0
>         Environment: Windows XP SP3, ActiveMQ 5.2, prefetchSize=0 (java.naming.provider.url = tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=0)
>            Reporter: Carl Allain
>         Attachments: AMQ-2446-Test.zip
>
>
> Start ActiveMQ
> create a message consumer and make a receive(30000) call for example.
> stop ActiveMQ (CTRL-C)
> There is an error reported on the console:
> 2009-10-08 19:23:54,978 [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616] DEBUG org.apache.activemq.ActiveMQConnection - Async exception with no exception listener: java.io.EOFException
> java.io.EOFException
> 	at java.io.DataInputStream.readInt(DataInputStream.java:358)
> 	at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:269)
> 	at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:210)
> 	at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:202)
> 	at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:185)
> 	at java.lang.Thread.run(Thread.java:595)
> 2009-10-08 19:23:54,978 [ActiveMQ Connection Worker: tcp://localhost/127.0.0.1:61616] DEBUG org.apache.activemq.transport.tcp.TcpTransport - Stopping transport tcp://localhost/127.0.0.1:61616
> The thread making the receive call is waiting on a mutex that the ActiveMQ Connection Worker thread that reported that log has (I guess):
> class MessageDispatchChannel
>     public MessageDispatch dequeue(long timeout) throws InterruptedException {
>         synchronized (mutex) {
>             // Wait until the consumer is ready to deliver messages.
>             while (timeout != 0 && !closed && (list.isEmpty() || !running)) {
>                 if (timeout == -1) {
>                     mutex.wait(); <-----------------------------------------------------------
>                 } else {
>                     mutex.wait(timeout);
>                     break;
>                 }
>             }
>             if (closed || !running || list.isEmpty()) {
>                 return null;
>             }
>             return list.removeFirst();
>         }
>     }
> What is also strange to me is that my timeout of 30000 ms is silently converted to an infinite timeout if the preFetchSize == 0 by this code? Why?
> class ActiveMQMessageConsumer
> ...
>             MessageDispatch md;
>             if (info.getPrefetchSize() == 0) {
>                 md = dequeue(-1); // We let the broker let us know when we
>                 // timeout.
>             } else {
>                 md = dequeue(timeout);
>             }

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


[jira] Updated: (AMQ-2446) Client hangs on receive call with timeout value > 0 when activemq is shutdown (CTRL-C)

Posted by "Gary Tully (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-2446?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Tully updated AMQ-2446:
----------------------------

    Attachment: AMQ2446Test.java

junit tests case that demos that this works with trunk and hence 5.3

> Client hangs on receive call with timeout value > 0 when activemq is shutdown (CTRL-C)
> --------------------------------------------------------------------------------------
>
>                 Key: AMQ-2446
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2446
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.2.0
>         Environment: Windows XP SP3, ActiveMQ 5.2, prefetchSize=0 (java.naming.provider.url = tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=0)
>            Reporter: Carl Allain
>         Attachments: AMQ-2446-Test.zip, AMQ2446Test.java
>
>
> Start ActiveMQ
> create a message consumer and make a receive(30000) call for example.
> stop ActiveMQ (CTRL-C)
> There is an error reported on the console:
> 2009-10-08 19:23:54,978 [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616] DEBUG org.apache.activemq.ActiveMQConnection - Async exception with no exception listener: java.io.EOFException
> java.io.EOFException
> 	at java.io.DataInputStream.readInt(DataInputStream.java:358)
> 	at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:269)
> 	at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:210)
> 	at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:202)
> 	at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:185)
> 	at java.lang.Thread.run(Thread.java:595)
> 2009-10-08 19:23:54,978 [ActiveMQ Connection Worker: tcp://localhost/127.0.0.1:61616] DEBUG org.apache.activemq.transport.tcp.TcpTransport - Stopping transport tcp://localhost/127.0.0.1:61616
> The thread making the receive call is waiting on a mutex that the ActiveMQ Connection Worker thread that reported that log has (I guess):
> class MessageDispatchChannel
>     public MessageDispatch dequeue(long timeout) throws InterruptedException {
>         synchronized (mutex) {
>             // Wait until the consumer is ready to deliver messages.
>             while (timeout != 0 && !closed && (list.isEmpty() || !running)) {
>                 if (timeout == -1) {
>                     mutex.wait(); <-----------------------------------------------------------
>                 } else {
>                     mutex.wait(timeout);
>                     break;
>                 }
>             }
>             if (closed || !running || list.isEmpty()) {
>                 return null;
>             }
>             return list.removeFirst();
>         }
>     }
> What is also strange to me is that my timeout of 30000 ms is silently converted to an infinite timeout if the preFetchSize == 0 by this code? Why?
> class ActiveMQMessageConsumer
> ...
>             MessageDispatch md;
>             if (info.getPrefetchSize() == 0) {
>                 md = dequeue(-1); // We let the broker let us know when we
>                 // timeout.
>             } else {
>                 md = dequeue(timeout);
>             }

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


[jira] Updated: (AMQ-2446) Client hangs on receive call with timeout value > 0 when activemq is shutdown (CTRL-C)

Posted by "Carl Allain (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-2446?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carl Allain updated AMQ-2446:
-----------------------------

    Attachment: AMQ-2446-Test.zip

Contains an Eclipse 3.3 project.

> Client hangs on receive call with timeout value > 0 when activemq is shutdown (CTRL-C)
> --------------------------------------------------------------------------------------
>
>                 Key: AMQ-2446
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2446
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.2.0
>         Environment: Windows XP SP3, ActiveMQ 5.2, prefetchSize=0 (java.naming.provider.url = tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=0)
>            Reporter: Carl Allain
>         Attachments: AMQ-2446-Test.zip
>
>
> Start ActiveMQ
> create a message consumer and make a receive(30000) call for example.
> stop ActiveMQ (CTRL-C)
> There is an error reported on the console:
> 2009-10-08 19:23:54,978 [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616] DEBUG org.apache.activemq.ActiveMQConnection - Async exception with no exception listener: java.io.EOFException
> java.io.EOFException
> 	at java.io.DataInputStream.readInt(DataInputStream.java:358)
> 	at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:269)
> 	at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:210)
> 	at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:202)
> 	at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:185)
> 	at java.lang.Thread.run(Thread.java:595)
> 2009-10-08 19:23:54,978 [ActiveMQ Connection Worker: tcp://localhost/127.0.0.1:61616] DEBUG org.apache.activemq.transport.tcp.TcpTransport - Stopping transport tcp://localhost/127.0.0.1:61616
> The thread making the receive call is waiting on a mutex that the ActiveMQ Connection Worker thread that reported that log has (I guess):
> class MessageDispatchChannel
>     public MessageDispatch dequeue(long timeout) throws InterruptedException {
>         synchronized (mutex) {
>             // Wait until the consumer is ready to deliver messages.
>             while (timeout != 0 && !closed && (list.isEmpty() || !running)) {
>                 if (timeout == -1) {
>                     mutex.wait(); <-----------------------------------------------------------
>                 } else {
>                     mutex.wait(timeout);
>                     break;
>                 }
>             }
>             if (closed || !running || list.isEmpty()) {
>                 return null;
>             }
>             return list.removeFirst();
>         }
>     }
> What is also strange to me is that my timeout of 30000 ms is silently converted to an infinite timeout if the preFetchSize == 0 by this code? Why?
> class ActiveMQMessageConsumer
> ...
>             MessageDispatch md;
>             if (info.getPrefetchSize() == 0) {
>                 md = dequeue(-1); // We let the broker let us know when we
>                 // timeout.
>             } else {
>                 md = dequeue(timeout);
>             }

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


[jira] Commented: (AMQ-2446) Client hangs on receive call with timeout value > 0 when activemq is shutdown (CTRL-C)

Posted by "Carl Allain (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=54695#action_54695 ] 

Carl Allain commented on AMQ-2446:
----------------------------------

Hi. I D/L 5.3 RC4 from the link above. I took my application, added the activemq-all-5.3.0.jar jar in my classpath (before other jars) and I still have the same problem (client hangs). I can't vote for a 5.3 RC4 without this being fixed ;-). It is just normal that sometimes, the broker has to be stopped and clients should really not hang like that.

In the mean time, I redesigned portions of my app to use receiveNoWait() + my own thread sleeping logic (more latency though on new messages added to an empty queue of course) instead of receive(timeout) and with that, event with the 5.2 version, I get some exceptions that I can use to recover lost connections, and still use the prefetchSize=0 option on my connection URL.

Still, we have an integration component using Camel on top of ActiveMQ, and for that one, there is not much I can do.

Thanks.



> Client hangs on receive call with timeout value > 0 when activemq is shutdown (CTRL-C)
> --------------------------------------------------------------------------------------
>
>                 Key: AMQ-2446
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2446
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.2.0
>         Environment: Windows XP SP3, ActiveMQ 5.2, prefetchSize=0 (java.naming.provider.url = tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=0)
>            Reporter: Carl Allain
>
> Start ActiveMQ
> create a message consumer and make a receive(30000) call for example.
> stop ActiveMQ (CTRL-C)
> There is an error reported on the console:
> 2009-10-08 19:23:54,978 [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616] DEBUG org.apache.activemq.ActiveMQConnection - Async exception with no exception listener: java.io.EOFException
> java.io.EOFException
> 	at java.io.DataInputStream.readInt(DataInputStream.java:358)
> 	at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:269)
> 	at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:210)
> 	at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:202)
> 	at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:185)
> 	at java.lang.Thread.run(Thread.java:595)
> 2009-10-08 19:23:54,978 [ActiveMQ Connection Worker: tcp://localhost/127.0.0.1:61616] DEBUG org.apache.activemq.transport.tcp.TcpTransport - Stopping transport tcp://localhost/127.0.0.1:61616
> The thread making the receive call is waiting on a mutex that the ActiveMQ Connection Worker thread that reported that log has (I guess):
> class MessageDispatchChannel
>     public MessageDispatch dequeue(long timeout) throws InterruptedException {
>         synchronized (mutex) {
>             // Wait until the consumer is ready to deliver messages.
>             while (timeout != 0 && !closed && (list.isEmpty() || !running)) {
>                 if (timeout == -1) {
>                     mutex.wait(); <-----------------------------------------------------------
>                 } else {
>                     mutex.wait(timeout);
>                     break;
>                 }
>             }
>             if (closed || !running || list.isEmpty()) {
>                 return null;
>             }
>             return list.removeFirst();
>         }
>     }
> What is also strange to me is that my timeout of 30000 ms is silently converted to an infinite timeout if the preFetchSize == 0 by this code? Why?
> class ActiveMQMessageConsumer
> ...
>             MessageDispatch md;
>             if (info.getPrefetchSize() == 0) {
>                 md = dequeue(-1); // We let the broker let us know when we
>                 // timeout.
>             } else {
>                 md = dequeue(timeout);
>             }

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


[jira] Commented: (AMQ-2446) Client hangs on receive call with timeout value > 0 when activemq is shutdown (CTRL-C)

Posted by "Gary Tully (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=54692#action_54692 ] 

Gary Tully commented on AMQ-2446:
---------------------------------

would it be possible to run your test case against the current 5.3 release candidate to see if it is resolved. Details of where to find the kits are in the current vote message to the dev list: see: http://www.nabble.com/-VOTE--Apache-ActiveMQ-5.3.0-RC4-ts25802076.html


> Client hangs on receive call with timeout value > 0 when activemq is shutdown (CTRL-C)
> --------------------------------------------------------------------------------------
>
>                 Key: AMQ-2446
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2446
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.2.0
>         Environment: Windows XP SP3, ActiveMQ 5.2, prefetchSize=0 (java.naming.provider.url = tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=0)
>            Reporter: Carl Allain
>
> Start ActiveMQ
> create a message consumer and make a receive(30000) call for example.
> stop ActiveMQ (CTRL-C)
> There is an error reported on the console:
> 2009-10-08 19:23:54,978 [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616] DEBUG org.apache.activemq.ActiveMQConnection - Async exception with no exception listener: java.io.EOFException
> java.io.EOFException
> 	at java.io.DataInputStream.readInt(DataInputStream.java:358)
> 	at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:269)
> 	at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:210)
> 	at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:202)
> 	at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:185)
> 	at java.lang.Thread.run(Thread.java:595)
> 2009-10-08 19:23:54,978 [ActiveMQ Connection Worker: tcp://localhost/127.0.0.1:61616] DEBUG org.apache.activemq.transport.tcp.TcpTransport - Stopping transport tcp://localhost/127.0.0.1:61616
> The thread making the receive call is waiting on a mutex that the ActiveMQ Connection Worker thread that reported that log has (I guess):
> class MessageDispatchChannel
>     public MessageDispatch dequeue(long timeout) throws InterruptedException {
>         synchronized (mutex) {
>             // Wait until the consumer is ready to deliver messages.
>             while (timeout != 0 && !closed && (list.isEmpty() || !running)) {
>                 if (timeout == -1) {
>                     mutex.wait(); <-----------------------------------------------------------
>                 } else {
>                     mutex.wait(timeout);
>                     break;
>                 }
>             }
>             if (closed || !running || list.isEmpty()) {
>                 return null;
>             }
>             return list.removeFirst();
>         }
>     }
> What is also strange to me is that my timeout of 30000 ms is silently converted to an infinite timeout if the preFetchSize == 0 by this code? Why?
> class ActiveMQMessageConsumer
> ...
>             MessageDispatch md;
>             if (info.getPrefetchSize() == 0) {
>                 md = dequeue(-1); // We let the broker let us know when we
>                 // timeout.
>             } else {
>                 md = dequeue(timeout);
>             }

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


[jira] Commented: (AMQ-2446) Client hangs on receive call with timeout value > 0 when activemq is shutdown (CTRL-C)

Posted by "Adrian Lisenberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=63449#action_63449 ] 

Adrian Lisenberg commented on AMQ-2446:
---------------------------------------

Hi, I am using 5.4.1 and still have the same situation. I use prefetch=0, failover and connection pool. 

Sometimes when I call receive(1000), the consumer hangs at this line:

org.apache.activemq.SimplePriorityMessageDispatchChannel.dequeue(SimplePriorityMessageDispatchChannel.java:87)
org.apache.activemq.ActiveMQMessageConsumer.dequeue(ActiveMQMessageConsumer.java:452)

It's very difficult to reproduce with a test case.

thanks,
adrian

> Client hangs on receive call with timeout value > 0 when activemq is shutdown (CTRL-C)
> --------------------------------------------------------------------------------------
>
>                 Key: AMQ-2446
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2446
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.2.0
>         Environment: Windows XP SP3, ActiveMQ 5.2, prefetchSize=0 (java.naming.provider.url = tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=0)
>            Reporter: Carl Allain
>            Assignee: Gary Tully
>             Fix For: 5.3.0
>
>         Attachments: AMQ-2446-Test.zip, AMQ2446Test.java
>
>
> Start ActiveMQ
> create a message consumer and make a receive(30000) call for example.
> stop ActiveMQ (CTRL-C)
> There is an error reported on the console:
> 2009-10-08 19:23:54,978 [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616] DEBUG org.apache.activemq.ActiveMQConnection - Async exception with no exception listener: java.io.EOFException
> java.io.EOFException
> 	at java.io.DataInputStream.readInt(DataInputStream.java:358)
> 	at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:269)
> 	at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:210)
> 	at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:202)
> 	at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:185)
> 	at java.lang.Thread.run(Thread.java:595)
> 2009-10-08 19:23:54,978 [ActiveMQ Connection Worker: tcp://localhost/127.0.0.1:61616] DEBUG org.apache.activemq.transport.tcp.TcpTransport - Stopping transport tcp://localhost/127.0.0.1:61616
> The thread making the receive call is waiting on a mutex that the ActiveMQ Connection Worker thread that reported that log has (I guess):
> class MessageDispatchChannel
>     public MessageDispatch dequeue(long timeout) throws InterruptedException {
>         synchronized (mutex) {
>             // Wait until the consumer is ready to deliver messages.
>             while (timeout != 0 && !closed && (list.isEmpty() || !running)) {
>                 if (timeout == -1) {
>                     mutex.wait(); <-----------------------------------------------------------
>                 } else {
>                     mutex.wait(timeout);
>                     break;
>                 }
>             }
>             if (closed || !running || list.isEmpty()) {
>                 return null;
>             }
>             return list.removeFirst();
>         }
>     }
> What is also strange to me is that my timeout of 30000 ms is silently converted to an infinite timeout if the preFetchSize == 0 by this code? Why?
> class ActiveMQMessageConsumer
> ...
>             MessageDispatch md;
>             if (info.getPrefetchSize() == 0) {
>                 md = dequeue(-1); // We let the broker let us know when we
>                 // timeout.
>             } else {
>                 md = dequeue(timeout);
>             }

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


[jira] Commented: (AMQ-2446) Client hangs on receive call with timeout value > 0 when activemq is shutdown (CTRL-C)

Posted by "Carl Allain (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=54678#action_54678 ] 

Carl Allain commented on AMQ-2446:
----------------------------------

I think this may be linked to https://issues.apache.org/activemq/browse/AMQ-2044.

> Client hangs on receive call with timeout value > 0 when activemq is shutdown (CTRL-C)
> --------------------------------------------------------------------------------------
>
>                 Key: AMQ-2446
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2446
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.2.0
>         Environment: Windows XP SP3, ActiveMQ 5.2, prefetchSize=0 (java.naming.provider.url = tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=0)
>            Reporter: Carl Allain
>
> Start ActiveMQ
> create a message consumer and make a receive(30000) call for example.
> stop ActiveMQ (CTRL-C)
> There is an error reported on the console:
> 2009-10-08 19:23:54,978 [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616] DEBUG org.apache.activemq.ActiveMQConnection - Async exception with no exception listener: java.io.EOFException
> java.io.EOFException
> 	at java.io.DataInputStream.readInt(DataInputStream.java:358)
> 	at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:269)
> 	at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:210)
> 	at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:202)
> 	at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:185)
> 	at java.lang.Thread.run(Thread.java:595)
> 2009-10-08 19:23:54,978 [ActiveMQ Connection Worker: tcp://localhost/127.0.0.1:61616] DEBUG org.apache.activemq.transport.tcp.TcpTransport - Stopping transport tcp://localhost/127.0.0.1:61616
> The thread making the receive call is waiting on a mutex that the ActiveMQ Connection Worker thread that reported that log has (I guess):
> class MessageDispatchChannel
>     public MessageDispatch dequeue(long timeout) throws InterruptedException {
>         synchronized (mutex) {
>             // Wait until the consumer is ready to deliver messages.
>             while (timeout != 0 && !closed && (list.isEmpty() || !running)) {
>                 if (timeout == -1) {
>                     mutex.wait(); <-----------------------------------------------------------
>                 } else {
>                     mutex.wait(timeout);
>                     break;
>                 }
>             }
>             if (closed || !running || list.isEmpty()) {
>                 return null;
>             }
>             return list.removeFirst();
>         }
>     }
> What is also strange to me is that my timeout of 30000 ms is silently converted to an infinite timeout if the preFetchSize == 0 by this code? Why?
> class ActiveMQMessageConsumer
> ...
>             MessageDispatch md;
>             if (info.getPrefetchSize() == 0) {
>                 md = dequeue(-1); // We let the broker let us know when we
>                 // timeout.
>             } else {
>                 md = dequeue(timeout);
>             }

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


[jira] Commented: (AMQ-2446) Client hangs on receive call with timeout value > 0 when activemq is shutdown (CTRL-C)

Posted by "Carl Allain (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=54702#action_54702 ] 

Carl Allain commented on AMQ-2446:
----------------------------------

Of course, when using activemq-all-5.2.0.jar, I was running ActiveMQ 5.2 server and when using activemq-all-5.3.0.jar, I was running 5.3.

> Client hangs on receive call with timeout value > 0 when activemq is shutdown (CTRL-C)
> --------------------------------------------------------------------------------------
>
>                 Key: AMQ-2446
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2446
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.2.0
>         Environment: Windows XP SP3, ActiveMQ 5.2, prefetchSize=0 (java.naming.provider.url = tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=0)
>            Reporter: Carl Allain
>         Attachments: AMQ-2446-Test.zip
>
>
> Start ActiveMQ
> create a message consumer and make a receive(30000) call for example.
> stop ActiveMQ (CTRL-C)
> There is an error reported on the console:
> 2009-10-08 19:23:54,978 [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616] DEBUG org.apache.activemq.ActiveMQConnection - Async exception with no exception listener: java.io.EOFException
> java.io.EOFException
> 	at java.io.DataInputStream.readInt(DataInputStream.java:358)
> 	at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:269)
> 	at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:210)
> 	at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:202)
> 	at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:185)
> 	at java.lang.Thread.run(Thread.java:595)
> 2009-10-08 19:23:54,978 [ActiveMQ Connection Worker: tcp://localhost/127.0.0.1:61616] DEBUG org.apache.activemq.transport.tcp.TcpTransport - Stopping transport tcp://localhost/127.0.0.1:61616
> The thread making the receive call is waiting on a mutex that the ActiveMQ Connection Worker thread that reported that log has (I guess):
> class MessageDispatchChannel
>     public MessageDispatch dequeue(long timeout) throws InterruptedException {
>         synchronized (mutex) {
>             // Wait until the consumer is ready to deliver messages.
>             while (timeout != 0 && !closed && (list.isEmpty() || !running)) {
>                 if (timeout == -1) {
>                     mutex.wait(); <-----------------------------------------------------------
>                 } else {
>                     mutex.wait(timeout);
>                     break;
>                 }
>             }
>             if (closed || !running || list.isEmpty()) {
>                 return null;
>             }
>             return list.removeFirst();
>         }
>     }
> What is also strange to me is that my timeout of 30000 ms is silently converted to an infinite timeout if the preFetchSize == 0 by this code? Why?
> class ActiveMQMessageConsumer
> ...
>             MessageDispatch md;
>             if (info.getPrefetchSize() == 0) {
>                 md = dequeue(-1); // We let the broker let us know when we
>                 // timeout.
>             } else {
>                 md = dequeue(timeout);
>             }

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


[jira] Resolved: (AMQ-2446) Client hangs on receive call with timeout value > 0 when activemq is shutdown (CTRL-C)

Posted by "Gary Tully (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-2446?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Tully resolved AMQ-2446.
-----------------------------

       Resolution: Fixed
    Fix Version/s: 5.3.0
         Assignee: Gary Tully

glad to see we both came to the same conclusion :-) I had just run my junit tests case that worked fine against trunk. thanks,

> Client hangs on receive call with timeout value > 0 when activemq is shutdown (CTRL-C)
> --------------------------------------------------------------------------------------
>
>                 Key: AMQ-2446
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2446
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.2.0
>         Environment: Windows XP SP3, ActiveMQ 5.2, prefetchSize=0 (java.naming.provider.url = tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=0)
>            Reporter: Carl Allain
>            Assignee: Gary Tully
>             Fix For: 5.3.0
>
>         Attachments: AMQ-2446-Test.zip, AMQ2446Test.java
>
>
> Start ActiveMQ
> create a message consumer and make a receive(30000) call for example.
> stop ActiveMQ (CTRL-C)
> There is an error reported on the console:
> 2009-10-08 19:23:54,978 [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616] DEBUG org.apache.activemq.ActiveMQConnection - Async exception with no exception listener: java.io.EOFException
> java.io.EOFException
> 	at java.io.DataInputStream.readInt(DataInputStream.java:358)
> 	at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:269)
> 	at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:210)
> 	at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:202)
> 	at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:185)
> 	at java.lang.Thread.run(Thread.java:595)
> 2009-10-08 19:23:54,978 [ActiveMQ Connection Worker: tcp://localhost/127.0.0.1:61616] DEBUG org.apache.activemq.transport.tcp.TcpTransport - Stopping transport tcp://localhost/127.0.0.1:61616
> The thread making the receive call is waiting on a mutex that the ActiveMQ Connection Worker thread that reported that log has (I guess):
> class MessageDispatchChannel
>     public MessageDispatch dequeue(long timeout) throws InterruptedException {
>         synchronized (mutex) {
>             // Wait until the consumer is ready to deliver messages.
>             while (timeout != 0 && !closed && (list.isEmpty() || !running)) {
>                 if (timeout == -1) {
>                     mutex.wait(); <-----------------------------------------------------------
>                 } else {
>                     mutex.wait(timeout);
>                     break;
>                 }
>             }
>             if (closed || !running || list.isEmpty()) {
>                 return null;
>             }
>             return list.removeFirst();
>         }
>     }
> What is also strange to me is that my timeout of 30000 ms is silently converted to an infinite timeout if the preFetchSize == 0 by this code? Why?
> class ActiveMQMessageConsumer
> ...
>             MessageDispatch md;
>             if (info.getPrefetchSize() == 0) {
>                 md = dequeue(-1); // We let the broker let us know when we
>                 // timeout.
>             } else {
>                 md = dequeue(timeout);
>             }

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