#2841 protonmsg db queue: incorrect data format for _send_msg()
Closed: Fixed 2 years ago by tkopecek. Opened 2 years ago by mikem.

The _send_msg function expects a list of tuples of the form (address, props, body) as added in queue_msg. However, in handle_db_msgs we have

query = QueryProcessor(tables=('proton_queue',),
                       columns=('id', 'address', 'props', 'body'),
                       opts={'order': 'id', 'limit': limit})
msgs = list(query.execute())

Resulting in a list of dictionaries.

This leads to:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/koji/plugin.py", line 205, in run_callbacks
    func(cbtype, *cb_args, **cb_kwargs)
  File "/usr/lib/koji-hub-plugins/protonmsg.py", line 419, in send_queued_msgs
    handle_db_msgs(urls, CONFIG)
  File "/usr/lib/koji-hub-plugins/protonmsg.py", line 360, in handle_db_msgs
    unsent = {m['id'] for m in _send_msgs(urls, msgs, CONFIG)}
  File "/usr/lib/koji-hub-plugins/protonmsg.py", line 304, in _send_msgs
    container.run()
  File "/usr/lib64/python3.6/site-packages/proton/_reactor.py", line 180, in run
    while self.process(): pass
  File "/usr/lib64/python3.6/site-packages/proton/_reactor.py", line 237, in process
    event.dispatch(handler)
  File "/usr/lib64/python3.6/site-packages/proton/_events.py", line 165, in dispatch
    self.dispatch(h, type)
  File "/usr/lib64/python3.6/site-packages/proton/_events.py", line 165, in dispatch
    self.dispatch(h, type)
  File "/usr/lib64/python3.6/site-packages/proton/_events.py", line 162, in dispatch
    _dispatch(handler, type.method, self)
  File "/usr/lib64/python3.6/site-packages/proton/_events.py", line 123, in _dispatch
    m(*args)
  File "/usr/lib64/python3.6/site-packages/proton/_handlers.py", line 457, in on_connection_remote_open
    self.on_connection_opened(event)
  File "/usr/lib64/python3.6/site-packages/proton/_handlers.py", line 494, in on_connection_opened
    _dispatch(self.delegate, 'on_connection_opened', event)
  File "/usr/lib64/python3.6/site-packages/proton/_events.py", line 123, in _dispatch
    m(*args)
  File "/usr/lib/koji-hub-plugins/protonmsg.py", line 75, in on_connection_opened
    self.send_msgs(event)
  File "/usr/lib/koji-hub-plugins/protonmsg.py", line 80, in send_msgs
    address = 'topic://' + prefix + '.' + msg[0]
KeyError: 0

Which happens on every postCommit. The db queue remains untouched and unsent.


When my instance got into this state, I believe it lost a bunch of messages because of this error. We should clearly separate the code that sends from the db queue and the code that handles the new messages. A failure to send from the queue should not keep us from adding to it.

Metadata Update from @mikem:
- Custom field Size adjusted to None

2 years ago

Also, looking at handle_db_msgs() again, it seems like we should handle the common case of no queued messages more directly. I don't think it makes sense to call _send_msgs with an empty list, or log that we're skipping zero messages.

Metadata Update from @tkopecek:
- Issue set to the milestone: 1.25.1

2 years ago

Metadata Update from @tkopecek:
- Issue set to the milestone: 1.25 (was: 1.25.1)

2 years ago

Metadata Update from @tkopecek:
- Issue tagged with: testing-ready

2 years ago

Metadata Update from @mfilip:
- Issue tagged with: testing-done

2 years ago

Login to comment on this ticket.

Metadata
Related Pull Requests
  • #2844 Merged 2 years ago