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.
The problem here is
self._cb
might throwFrameUnderflow
exception (easy to reproduce if you have large messages), but it happens afterself._read
is set toFalse
. It causeswhile wrapper._read
to terminate early, whenwrapper._result
is stillNone
, and thus message will be lost.I'm not sure how to fix it, though.