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

'gevent._greenlet.Greenlet' object has no attribute 'ident_registry' #1363

Closed
carsonip opened this issue Mar 18, 2019 · 4 comments

Comments

Projects
None yet
2 participants
@carsonip
Copy link
Contributor

commented Mar 18, 2019

  • gevent version: 1.3.7
  • Python version: cPython 2.7.12
  • Operating System: Ubuntu 16.04

Description:

Not sure exactly how this happened, but I saw this in my logs:

'gevent._greenlet.Greenlet' object has no attribute 'ident_registry'
Traceback (most recent call last):
  File "venv/local/lib/python2.7/site-packages/raven/utils/serializer/manager.py", line 76, in transform
    return repr(value)
  File "src/gevent/greenlet.py", line 429, in gevent._greenlet.Greenlet.__repr__
  File "venv/local/lib/python2.7/site-packages/gevent/_util.py", line 152, in __get__
    return self.func(inst)
  File "src/gevent/greenlet.py", line 309, in gevent._greenlet.Greenlet.name
  File "src/gevent/greenlet.py", line 297, in gevent._greenlet.Greenlet.minimal_ident.__get__
  File "src/gevent/greenlet.py", line 276, in gevent._greenlet.Greenlet._get_minimal_ident
AttributeError: 'gevent._greenlet.Greenlet' object has no attribute 'ident_registry'

Not completely sure whether it is raven's (sentry) fault or gevent's issue. Any thoughts?

@jamadden

This comment has been minimized.

Copy link
Member

commented Mar 18, 2019

Hmm. It looks like you wound up with a gevent Greenlet object whose parent was not the gevent Hub.

Constructing Greenlet objects always uses the hub as the parent. Otherwise, gevent won't ever be able to switch to that greenlet (well, maybe it would switch to it, but things would break down trying to switch back or wait on it).

I can't find anywhere that gevent changes the parent of a Greenlet once it is constructed. Is there a chance somewhere in your code is manipulating the parent attribute?

@jamadden jamadden added the question label Mar 18, 2019

@carsonip

This comment has been minimized.

Copy link
Contributor Author

commented Mar 19, 2019

As far as I can tell, I didn't touch the parent attribute of greenlets. The error happens after sqlalchemy & mysqlclient (mysqldb) raises an OperationalError. I used a (deprecated and now removed) waiter of mysqlclient like https://github.com/PyMySQL/mysqlclient-python/blob/53764264945fb26d5a21dd9000c4ea5eefdc6e2d/samples/waiter_gevent.py to wait for a fd after every query.

def gevent_waiter(fd, hub=gevent.hub.get_hub()):
    hub.wait(hub.loop.io(fd, 1))

Is this relevant?

@jamadden

This comment has been minimized.

Copy link
Member

commented Mar 19, 2019

Thanks. Unfortunately I don't see how that snippet would be relevant.

@jamadden

This comment has been minimized.

Copy link
Member

commented Mar 29, 2019

Looking into this more, gevent 1.4.0 rewrote the way that the __repr__ is implemented, so this shouldn't be possible with that version.

Thanks for the report!

@jamadden jamadden closed this Mar 29, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.