You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[This is related to https://github.com//issues/11 and https://github.com//issues/12]
Create a channel-close listener function that raises Exception() and register it via Channel.add_close_listener(); the exception doesn't have to come explicitly from the channel-closer listener: if the listener calls a Gevent API that results in context switch and then another greenlet kills the greenlet that was executing the channel-close listener, then a GreenletExit (or another exception such as LinkedFailed, etc.) would be injected into that greenlet, causing the exception to be raised in channel-close listener function.
Then do something that causes the broker to close your channel; this happened to me with RabbitMQ when I set qos as ch.basic.qos(prefetch_count=1), but forgot to pass no_ack=False to ch.basic.consume(), and then sent some messages to an exchange that was bound to the consumer's queue; when my code ACK'ed the incoming message, the broker no longer had a matching message in the queue (since no_ack was True by default) and closed the channel to signal an error condition.
If the channel-close listener callback is called from the scope of self.dispatch(), then by the time the exception that was raised in my channel-close listener is caught by process_frames(), both self._connection and self._logger of the Channel instance are None (cleared by Channel._closed_cb()). Since self.logger maps to self._connection.logger and self.close() maps to self.channel.close(), both of these calls would result in AttributeError exception. E.g.,
File "/Users/vkruglikov/Packages/haigha/agoragames-haigha-6540e82/build/lib/haigha/connection.py", line 318, in read_frames
self._transport.process_channels( p_channels )
File "/Users/vkruglikov/Packages/haigha/agoragames-haigha-6540e82/build/lib/haigha/transports/transport.py", line 32, in process_channels
channel.process_frames()
File "/Users/vkruglikov/Packages/haigha/agoragames-haigha-6540e82/build/lib/haigha/channel.py", line 148, in process_frames
self.logger.error(
File "/Users/vkruglikov/Packages/haigha/agoragames-haigha-6540e82/build/lib/haigha/channel.py", line 60, in logger
return self._connection.logger
AttributeError: 'NoneType' object has no attribute 'logger'
def process_frames(self):
"""
Process the input buffer.
"""
while len(self._frame_buffer):
try:
# It would make sense to call next_frame, but it's technically faster
# to repeat the code here.
frame = self._frame_buffer.popleft()
self.dispatch( frame )
except ProtocolClass.FrameUnderflow:
return
except:
self.logger.error(
"Failed to dispatch %s", frame, exc_info=True )
self.close( 500, "Failed to dispatch %s"%(str(frame)) )
return
The text was updated successfully, but these errors were encountered:
[This is related to https://github.com//issues/11 and https://github.com//issues/12]
If the channel-close listener callback is called from the scope of self.dispatch(), then by the time the exception that was raised in my channel-close listener is caught by process_frames(), both self._connection and self._logger of the Channel instance are None (cleared by Channel._closed_cb()). Since self.logger maps to self._connection.logger and self.close() maps to self.channel.close(), both of these calls would result in AttributeError exception. E.g.,
The text was updated successfully, but these errors were encountered: