agoragames / haigha

AMQP Python client
BSD 3-Clause "New" or "Revised" License
160 stars 41 forks source link

Synchronous basic.get with consumer=None is broken #102

Closed WGH- closed 5 years ago

WGH- commented 5 years ago
class SyncWrapper(object):
    def __call__(self, *args, **kwargs):
        self._read = False
        self._result = self._cb(*args, **kwargs)

The problem here is self._cb might throw FrameUnderflow exception (easy to reproduce if you have large messages), but it happens after self._read is set to False. It causes while wrapper._read to terminate early, when wrapper._result is still None, and thus message will be lost.

I'm not sure how to fix it, though.

WGH- commented 5 years ago

Sorry, dup of #83