1. Benjamin Smith
  2. python-stomp
  3. Issues
Issue #2 open

send hanging forever while waiting for receipt

Ask Solem Hoel
created an issue

Using ActiveMQ 5.2.0, sometimes send() hangs forever while waiting for a receipt. Deleting+recreating the queue fixes it.

Anyone seen something like this? It could be an issue with ActiveMQ of course. I can't see anything in activemq.log, maybe there's a way to add more logging?

Comments (13)

  1. Benjamin Smith repo owner

    Ok, I did some quick testing this morning to see if I could reproduce this, but I ended up finding another way to make it hang indefinitely. I have Authentication enabled on my ActiveMQ 5.2.0 install, and without sending a username and password in the headers, it will hang with the following stacktrace/errors in the activemq.log.

    DEBUG TransportConnection            - Setting up new connection: /10.10.231.137:41978
    WARN  TransportConnection            - Failed to add Connection
    java.lang.SecurityException: User name or password is invalid.
            at org.apache.activemq.security.SimpleAuthenticationBroker.addConnection(SimpleAuthenticationBroker.java:52)
            at org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:82)
            at org.apache.activemq.broker.MutableBrokerFilter.addConnection(MutableBrokerFilter.java:89)
            at org.apache.activemq.broker.TransportConnection.processAddConnection(TransportConnection.java:679)
            at org.apache.activemq.broker.jmx.ManagedTransportConnection.processAddConnection(ManagedTransportConnection.java:86)
            at org.apache.activemq.command.ConnectionInfo.visit(ConnectionInfo.java:125)
            at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:305)
            at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:179)
            at org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:68)
            at org.apache.activemq.transport.stomp.StompTransportFilter.sendToActiveMQ(StompTransportFilter.java:78)
            at org.apache.activemq.transport.stomp.ProtocolConverter.sendToActiveMQ(ProtocolConverter.java:135)
            at org.apache.activemq.transport.stomp.ProtocolConverter.onStompConnect(ProtocolConverter.java:475)
            at org.apache.activemq.transport.stomp.ProtocolConverter.onStompCommad(ProtocolConverter.java:187)
            at org.apache.activemq.transport.stomp.StompTransportFilter.onCommand(StompTransportFilter.java:67)
            at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:84)
            at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:203)
            at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:185)
            at java.lang.Thread.run(Thread.java:619)
    DEBUG Service                        - Error occured while processing sync command: java.lang.SecurityException: User name or password is invalid.
    java.lang.SecurityException: User name or password is invalid.
            at org.apache.activemq.security.SimpleAuthenticationBroker.addConnection(SimpleAuthenticationBroker.java:52)
            at org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:82)
            at org.apache.activemq.broker.MutableBrokerFilter.addConnection(MutableBrokerFilter.java:89)
            at org.apache.activemq.broker.TransportConnection.processAddConnection(TransportConnection.java:679)
            at org.apache.activemq.broker.jmx.ManagedTransportConnection.processAddConnection(ManagedTransportConnection.java:86)
            at org.apache.activemq.command.ConnectionInfo.visit(ConnectionInfo.java:125)
            at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:305)
            at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:179)
            at org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:68)
            at org.apache.activemq.transport.stomp.StompTransportFilter.sendToActiveMQ(StompTransportFilter.java:78)
            at org.apache.activemq.transport.stomp.ProtocolConverter.sendToActiveMQ(ProtocolConverter.java:135)
            at org.apache.activemq.transport.stomp.ProtocolConverter.onStompConnect(ProtocolConverter.java:475)
            at org.apache.activemq.transport.stomp.ProtocolConverter.onStompCommad(ProtocolConverter.java:187)
            at org.apache.activemq.transport.stomp.StompTransportFilter.onCommand(StompTransportFilter.java:67)
            at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:84)
            at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:203)
            at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:185)
            at java.lang.Thread.run(Thread.java:619)
    DEBUG Transport                      - Transport failed: java.io.IOException: User name or password is invalid.
    java.io.IOException: User name or password is invalid.
            at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:39)
            at org.apache.activemq.transport.stomp.ProtocolConverter$2.onResponse(ProtocolConverter.java:482)
            at org.apache.activemq.transport.stomp.ProtocolConverter.onActiveMQCommad(ProtocolConverter.java:551)
            at org.apache.activemq.transport.stomp.StompTransportFilter.oneway(StompTransportFilter.java:56)
            at org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:40)
            at org.apache.activemq.broker.TransportConnection.dispatch(TransportConnection.java:1207)
            at org.apache.activemq.broker.TransportConnection.processDispatch(TransportConnection.java:793)
            at org.apache.activemq.broker.TransportConnection.dispatchSync(TransportConnection.java:752)
            at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:181)
            at org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:68)
            at org.apache.activemq.transport.stomp.StompTransportFilter.sendToActiveMQ(StompTransportFilter.java:78)
            at org.apache.activemq.transport.stomp.ProtocolConverter.sendToActiveMQ(ProtocolConverter.java:135)
            at org.apache.activemq.transport.stomp.ProtocolConverter.onStompConnect(ProtocolConverter.java:475)
            at org.apache.activemq.transport.stomp.ProtocolConverter.onStompCommad(ProtocolConverter.java:187)
            at org.apache.activemq.transport.stomp.StompTransportFilter.onCommand(StompTransportFilter.java:67)
            at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:84)
            at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:203)
            at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:185)
            at java.lang.Thread.run(Thread.java:619)
    Caused by: java.lang.SecurityException: User name or password is invalid.
            at org.apache.activemq.security.SimpleAuthenticationBroker.addConnection(SimpleAuthenticationBroker.java:52)
            at org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:82)
            at org.apache.activemq.broker.MutableBrokerFilter.addConnection(MutableBrokerFilter.java:89)
            at org.apache.activemq.broker.TransportConnection.processAddConnection(TransportConnection.java:679)
            at org.apache.activemq.broker.jmx.ManagedTransportConnection.processAddConnection(ManagedTransportConnection.java:86)
            at org.apache.activemq.command.ConnectionInfo.visit(ConnectionInfo.java:125)
            at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:305)
            at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:179)
            ... 10 more
    DEBUG TransportConnection            - Stopping connection: /10.10.231.137:41978
    DEBUG TcpTransport                   - Stopping transport tcp:///10.10.231.137:41978
    DEBUG TransportConnection            - Stopped transport: /10.10.231.137:41978
    DEBUG TransportConnection            - Cleaning up connection resources: /10.10.231.137:41978
    DEBUG TransportConnection            - Connection Stopped: /10.10.231.137:41978
    
  2. Benjamin Smith repo owner

    Oh, also, if you'd like to enable more logging on ActiveMQ, edit conf/log4j.properties and add this entry:

    log4j.logger.org.apache.activemq=DEBUG
    

    and also in your activemq.xml, add 'trace' to your STOMP transport connector like so:

    <transportConnector name="stomp" uri="stomp://localhost:61613?trace=true"/>
    
  3. Tristan Zajonc

    I am having the same issue with stomp.put("test", destination="/home/topic"). The message is sent, but the function never returns. I'm using RabbitMQ<->Orbited and Python 2.6.4 on OSX.

    The example uses simple.send, which I assume should be simple.put since send doesn't exist.

  4. Tristan Zajonc

    The problem seems related to the receipt. Setting want_receipt=False in the send method seems to fix this problem, although I presume that it comes at the expense of something. I'm no STOMP expert.

  5. Benjamin Smith repo owner

    I can't seem to replicate the problem with Rabbit or ActiveMQ. I am able to get a receipt back from both brokers with no problem with Python 2.6.2, stompy 0.2.5 and Fedora 11.

    What platform are you all on?

  6. Martin Marcher

    I have this problem too.

    Using: CoilMQ==0.3dev, stompy==0.2.9 (both are pure python packages installed in separate virtualenv environments and `pip install...ed`

    $ coilmq -b 127.0.0.1 -p 61613 --debug
    2010-10-15 15:15:43,519 [MainThread] coilmq.start - INFO - Created server:<coilmq.server.socketserver.ThreadedStompServer instance at 0x7f356d3da2d8>
    2010-10-15 15:15:43,519 [MainThread] coilmq.start - INFO - Stomp server listening on 127.0.0.1:61613
    2010-10-15 15:15:55,576 [Thread-1] coilmq.server.socketserver.StompRequestHandler - DEBUG - Processing frame: <StompFrame cmd=CONNECT len=4>
    2010-10-15 15:15:55,576 [Thread-1] coilmq.engine.StompEngine - DEBUG - CONNECT
    2010-10-15 15:15:57,697 [Thread-1] coilmq.server.socketserver.StompRequestHandler - DEBUG - Processing frame: <StompFrame cmd=SEND len=7>
    2010-10-15 15:15:57,697 [Thread-1] coilmq.queue.QueueManager - DEBUG - No eligible subscribers; adding message <StompFrame cmd=MESSAGE len=7> to queue /queue/test
    2010-10-15 15:16:13,081 [Thread-2] coilmq.server.socketserver.StompRequestHandler - DEBUG - Processing frame: <StompFrame cmd=CONNECT len=4>
    2010-10-15 15:16:13,081 [Thread-2] coilmq.engine.StompEngine - DEBUG - CONNECT
    2010-10-15 15:16:18,345 [Thread-2] coilmq.server.socketserver.StompRequestHandler - DEBUG - Processing frame: <StompFrame cmd=SUBSCRIBE len=4>
    2010-10-15 15:16:18,345 [Thread-2] coilmq.queue.QueueManager - DEBUG - Subscribing <coilmq.server.socketserver.StompRequestHandler object at 0x7f356d3dd310> to /queue/test
    2010-10-15 15:16:18,346 [Thread-2] coilmq.queue.QueueManager - DEBUG - Sending backlog to <coilmq.server.socketserver.StompRequestHandler object at 0x7f356d3dd310> for destination /queue/test
    2010-10-15 15:16:18,346 [Thread-2] coilmq.queue.QueueManager - DEBUG - Delivering frame <StompFrame cmd=MESSAGE len=7> to connection <coilmq.server.socketserver.StompRequestHandler object at 0x7f356d3dd310>
    
    

    Client Session that sends:

    $ python
    Python 2.6.6 (r266:84292, Aug 29 2010, 12:36:23) 
    [GCC 4.4.5 20100824 (prerelease)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from stompy.simple import Client
    >>> stomp = Client()
    >>> stomp.connect()
    >>> stomp.put("MESG 01", destination="/queue/test", persistent=False)
    

    Client Session That receives:

    $ python
    Python 2.6.6 (r266:84292, Aug 29 2010, 12:36:23) 
    [GCC 4.4.5 20100824 (prerelease)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from stompy.simple import Client
    >>> stomp = Client()
    >>> stomp.connect()
    >>> stomp.subscribe("/queue/test")
    >>> msg = stomp.get_nowait()
    >>> msg
    <Frame {'destination': '/queue/test',
     'message-id': '3829d0d0-9e38-45e9-b2ea-91cb04a1d26f',
     'persistent': 'false',
     'receipt': 'b75865bb-3a75-4714-b853-f86ed981c2a2-6306573',
     'x-client': '127.0.1.1'}>
    >>> 
    
  7. Chris Yang

    I met the same error when send message with wither put() function from simple or send() function from stomp . I found the key point is that there is a parameter named want_receipt (only with a default value True) in stompy.stomp.send() as the following:

    https://bitbucket.org/benjaminws/python-stomp/src/21b121f627e4ee232393d4990396817035685f10/stompy/stomp.py?at=default

        def send(self, conf=None):
            """Send message to STOMP server
    
            You'll need to pass the body and any other headers your
            STOMP server likes.
    
            destination is **required**
    
            In the case of ActiveMQ with persistence, you could do this:
    
                >>> for i in xrange(1,1000):
                ...     stomp.send({'destination': '/queue/foo',
                ...                 'body': 'Testing',
                ...                 'persistent': 'true'})
    
            """
            headers = dict(conf)
            body = headers.pop("body", "")
            return self._send_command("SEND", headers, extra={"body": body},
                                      want_receipt=True)
    

    so if we do not want the receipt feature when send message , we'd better set want_receipt = false explicitly.

    I make a pull request for this issue right now:
    https://bitbucket.org/benjaminws/python-stomp/pull-requests/3/add-receipt-parameter-to-put-and-send

    My issue is fixed by the above way. And also I update this feature on github: https://github.com/benjaminws/python-stomp/pull/1 and release new version 0.2.10

    If possible please update stompy package info on pypi by your acoount: https://pypi.python.org/pypi/stompy/0.2.9

  8. Log in to comment