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

'ZmqREPConnection' object has no attribute '_routingInfo' #79

Closed
aryes opened this issue Nov 13, 2019 · 5 comments · Fixed by #80
Closed

'ZmqREPConnection' object has no attribute '_routingInfo' #79

aryes opened this issue Nov 13, 2019 · 5 comments · Fixed by #80

Comments

@aryes
Copy link

aryes commented Nov 13, 2019

In our project we encountered the following failure:


  File "/opt/neo/venv/lib/python2.7/site-packages/txzmq/req_rep.py", line 153, in __init__
    ZmqConnection.__init__(self, *args, **kwargs)
  File "/opt/neo/venv/lib/python2.7/site-packages/txzmq/connection.py", line 174, in __init__
    self.doRead()
  File "/opt/neo/venv/lib/python2.7/site-packages/txzmq/connection.py", line 281, in doRead
    log.callWithLogger(self, self.messageReceived, message)
--- <exception caught here> ---
  File "/opt/neo/venv/lib/python2.7/site-packages/twisted/python/log.py", line 88, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "/opt/neo/venv/lib/python2.7/site-packages/twisted/python/log.py", line 73, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "/opt/neo/venv/lib/python2.7/site-packages/twisted/python/context.py", line 118, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/opt/neo/venv/lib/python2.7/site-packages/twisted/python/context.py", line 81, in callWithContext
    return func(*args,**kw)
  File "/opt/neo/venv/lib/python2.7/site-packages/txzmq/req_rep.py", line 179, in messageReceived
    self._routingInfo[msgId] = routingInfo
exceptions.AttributeError: 'ZmqREPConnection' object has no attribute '_routingInfo'

It seems like the doRead called during initialization of ZmqREPConnection actually gets a message and tries to handle it, before the _routingInfo attribute was initialized later in its __init__.

@smira
Copy link
Owner

smira commented Nov 13, 2019

nice catch, it should be easy to fix by reorderding lines in __init__

smira added a commit that referenced this issue Nov 13, 2019
Fixes #79

ZmqConnection.__init__ adds connection to the read loop, so it might
receive any kind of data before method returns.
smira added a commit that referenced this issue Nov 13, 2019
Fixes #79

ZmqConnection.__init__ adds connection to the read loop, so it might
receive any kind of data before method returns.
smira added a commit that referenced this issue Nov 13, 2019
Fixes #79

ZmqConnection.__init__ adds connection to the read loop, so it might
receive any kind of data before method returns.
@smira smira closed this as completed in #80 Nov 13, 2019
@aryes
Copy link
Author

aryes commented Nov 14, 2019

Thanks for the quick reply. I looked at the commit and it looks like something is missing. I expected to see a change in req_rep.py, class ZmqREPConnection, lines 153-154:

        ZmqConnection.__init__(self, *args, **kwargs)
        self._routingInfo = {}  # keep track of routing info

the order of these lines should change, doesn't it?

Also, when will this change be available as a formal release?
Thanks :-)

@smira
Copy link
Owner

smira commented Nov 14, 2019

oh, looks like I somehow missed the 2nd constructor, sorry for that. I'll get it fixed and do a next release

smira added a commit that referenced this issue Nov 14, 2019
This is a follow-up change for #79, #80. I missed 2nd constructor in the
first PR.
@smira
Copy link
Owner

smira commented Nov 14, 2019

0.8.2 should be good I hope

@aryes
Copy link
Author

aryes commented Nov 14, 2019 via email

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

Successfully merging a pull request may close this issue.

2 participants