#3327 protonmsg plugin can lose messages on some types of errors
Closed: Fixed by tkopecek. Opened by mikem.

The protonmsg plugin is designed to store messages temporarily in the db if they cannot be sent. However, some types of connection issues can cause the callback to simply fail without either sending or storing the message, resulting in a lost message.

E.g.

Traceback (most recent call last):
  File \"\/usr\/lib\/python3.6\/site-packages\/koji\/plugin.py\", line 221, in run_callbacks
    func(cbtype, *cb_args, **cb_kwargs)
  File \"\/usr\/lib\/koji-hub-plugins\/protonmsg.py\", line 429, in send_queued_msgs
    unsent = _send_msgs(urls, msgs, CONFIG)
  File \"\/usr\/lib\/koji-hub-plugins\/protonmsg.py\", line 327, 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 239, in process
    event.dispatch(self._global_handler)
  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 125, in _dispatch
    handler.on_unhandled(method, *args)
  File \"\/usr\/lib64\/python3.6\/site-packages\/proton\/_reactor.py\", line 856, in on_unhandled
    event.dispatch(self.base)
  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 1333, in on_connection_bound
    addrs = socket.getaddrinfo(host, port, socket.AF_UNSPEC, socket.SOCK_STREAM)
  File \"\/usr\/lib64\/python3.6\/socket.py\", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

It would be nice if this such errors could be caught and treated as a failure to send.

We need to be careful here, as we need to be sure that the message was not sent before we place it in the db queue. This is probably not as simple has just adding an exception handler in _send_msgs.


Metadata Update from @tkopecek:
- Custom field Size adjusted to None
- Issue set to the milestone: 1.30

Metadata Update from @tkopecek:
- Issue tagged with: bug

PR #3360

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

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

Commit b94838b7 fixes this issue

Commit 1ca5db55 fixes this issue

This issue has been migrated to Fedora Forge:
https://forge.fedoraproject.org/koji/koji/issues/3327

Please continue any further discussion there.

Metadata
Related Pull Requests