stomp.py: Random out-of-range exceptions

I am getting the following exception when running my stomp.py based client for a while. There are no other warning signs. I am trying to consume the UK’s Network Rail datafeeds which use ActiveMQ as the backend.

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.4/threading.py", line 868, in run
    self._target(*self._args, **self._kwargs)
  File "/home/filip/RailDelay/server/lib/python3.4/site-packages/stomp/transport.py", line 299, in __receiver_loop
    f = utils.parse_frame(frame)
  File "/home/filip/RailDelay/server/lib/python3.4/site-packages/stomp/utils.py", line 131, in parse_frame
    f.cmd = preamble_lines[first_line]
IndexError: list index out of range

I am using the latest version of the package as published to pypi.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 17 (5 by maintainers)

Most upvoted comments

I’m using the following code in an AWS Lambda (Python 3.6) to write messages from API Gateway to Amazon MQ. The differences I notice are:

  1. I’m using the latest stomp.py (4.1.21)
  2. my port is a string and I use the full host name
  3. I’m using ssl_version=ssl.PROTOCOL_TLS
  4. I don’t pass in headers and persistent to client.send()

I found it useful to set up Active MQ on my local machine to test and debug my stomp.py calls. That’s how I figured out the correct ssl_version. I can view the Active MQ logs on my local machine, but I cannot figure out how to view the Active MQ logs on Amazon MQ. It appears that this is still an outstanding feature request.

    c = stomp.Connection([(host, port)])
    c.set_listener('', stomp.PrintingListener())
    c.set_ssl(for_hosts=[(host, port)], ssl_version=ssl.PROTOCOL_TLS)
    c.start()

    c.connect(login, password, wait=True)
    c.send(body=message, destination=queue)
    c.disconnect()

with 4.1.16 I cannot reproduce the same behaviour, this is what I get from logging


#: python simple.py
WARNING:stomp.py:Unknown response frame type: '�activemq' (frame length was 11)
WARNING:stomp.py:Unknown response frame type: '
                                               ' (frame length was 2)
WARNING:stomp.py:Unknown response frame type: 'o' (frame length was 2)
WARNING:stomp.py:Unknown response frame type: '
                                               ' (frame length was 1)
WARNING:stomp.py:Unknown response frame type: 'tcpnodelayenabled' (frame length was 20)
WARNING:stomp.py:Unknown response frame type: 'sizeprefixdisabled' (frame length was 20)
WARNING:stomp.py:Unknown response frame type: '	cachesize' (frame length was 11)
WARNING:stomp.py:Unknown response frame type: '' (frame length was 1)
WARNING:stomp.py:Unknown response frame type: '
                                               providername	' (frame length was 14)
WARNING:stomp.py:Unknown response frame type: activemq' (frame length was 9)
WARNING:stomp.py:Unknown response frame type: 'stacktraceenabled' (frame length was 20)
WARNING:stomp.py:Unknown response frame type: 'platformdetails	' (frame length was 17)
WARNING:stomp.py:Unknown response frame type: 'jjvm: 1.8.0_91, 25.91-b14, oracle corporation, os: linux, 4.9.4-moby, amd64' (frame length was 75)
WARNING:stomp.py:Unknown response frame type: '
                                               cacheenabled' (frame length was 15)
WARNING:stomp.py:Unknown response frame type: 'tightencodingenabled' (frame length was 23)
WARNING:stomp.py:Unknown response frame type: '
                                               maxframesize' (frame length was 14)
WARNING:stomp.py:Unknown response frame type: '@' (frame length was 2)
WARNING:stomp.py:Unknown response frame type: 'maxinactivityduration' (frame length was 23)
WARNING:stomp.py:Unknown response frame type: 'u0' (frame length was 2)
WARNING:stomp.py:Unknown response frame type: ' maxinactivitydurationinitaldelay' (frame length was 34)
WARNING:stomp.py:Unknown response frame type: ''' (frame length was 2)
WARNING:stomp.py:Unknown response frame type: 'providerversion	' (frame length was 17)

Hi @amihalik Thanks for your reply. It works 👍 when I changed the port from int to string.