AttributeError: "'NoneType' object has no attribute 'CHANNEL_CLOSE'

Issue #20 on hold
Alfredo Deza
created an issue

I was getting a few of those AttributeErrors and was finally able to narrow it down to the Message object being None in the Channel.del method.

The full error is:

 Exception AttributeError: "'NoneType' object has no attribute 'CHANNEL_CLOSE'" in <bound method Channel.__del__ of <Channel id=3 open>> ignored

After changing to make sure that Message was not None, I was no longer able to get the errors back:

            if Message is not None:
                if self._items is None:    # has_callback
                    msgcode = Message.CHANNEL_LAST_MESSAGE
                    msgcode = Message.CHANNEL_CLOSE
                except (IOError, ValueError): # ignore problems with sending

I am not sure though if this is the correct approach for the problem, or why is it in the first place that Message can be None.

Comments (4)

  1. Holger Krekel repo owner

    Globals in modules are set to None during interpreter shutdown to help with breaking GC cycles, and finalize all objects. Another possible fix would be to store Message on "self" to keep it available during shutdown. That is the approach other places in the code take. Would be cool if you try that approach and see if it fixes your problem and if so, do a PR.

  2. Log in to comment