Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BasicClass.get return value is inconsistent in synchronous mode #83

Open
vitaly-krugl opened this issue Jun 3, 2015 · 1 comment
Open

Comments

@vitaly-krugl
Copy link

In the implementation, self.channel.add_synchronous_cb(self._recv_get_response) only waits long enough for Basic.Get-ok/Get-empty method frame to arrive. So, if it gets Basic.Get-ok, but the Header and Content frames haven't arrived yet, it will return None, which is the same return value as when it gets Basic.Get-empty. So, quite often, there is actually a message on its way, but the BasicClass.get returns None, making the synchronous user think that the queue was empty, and that message will subsequently be "lost".

@WGH-
Copy link

WGH- commented Jun 20, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants