{"action":"closed","issue":{"url":"https://api.github.com/repos/celery/kombu/issues/443","repository_url":"https://api.github.com/repos/celery/kombu","labels_url":"https://api.github.com/repos/celery/kombu/issues/443/labels{/name}","comments_url":"https://api.github.com/repos/celery/kombu/issues/443/comments","events_url":"https://api.github.com/repos/celery/kombu/issues/443/events","html_url":"https://github.com/celery/kombu/issues/443","id":54767039,"number":443,"title":"mongodb backend doesn't work with eventlet","user":{"login":"buckensl","id":7717213,"avatar_url":"https://avatars.githubusercontent.com/u/7717213?v=3","gravatar_id":"","url":"https://api.github.com/users/buckensl","html_url":"https://github.com/buckensl","followers_url":"https://api.github.com/users/buckensl/followers","following_url":"https://api.github.com/users/buckensl/following{/other_user}","gists_url":"https://api.github.com/users/buckensl/gists{/gist_id}","starred_url":"https://api.github.com/users/buckensl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/buckensl/subscriptions","organizations_url":"https://api.github.com/users/buckensl/orgs","repos_url":"https://api.github.com/users/buckensl/repos","events_url":"https://api.github.com/users/buckensl/events{/privacy}","received_events_url":"https://api.github.com/users/buckensl/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/celery/kombu/labels/Component:%20MongoDB%20Broker%20(Unsupported)","name":"Component: MongoDB Broker (Unsupported)","color":"DDDDDD"},{"url":"https://api.github.com/repos/celery/kombu/labels/Status:%20Won't%20Fix","name":"Status: Won't Fix","color":"fef2c0"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2015-01-19T14:00:22Z","updated_at":"2016-07-08T21:58:55Z","closed_at":"2016-07-08T21:58:55Z","body":"Celery 3.1.16, Kombu 3.0.23, pymongo 2.7.2\r\n\r\nWhen starting a celery worker with --pool=eventlet, following exception is raised\r\n```\r\n2015-01-19 13:16:28.037 +0000 ERROR [__init__.start] Unrecoverable error: NameError(\"global name 'GeventEvent' is not defined\",)\r\nTraceback (most recent call last):\r\n  File \"venv/lib/python2.7/site-packages/celery/worker/__init__.py\", line 206, in start\r\n    self.blueprint.start(self)\r\n  File \"venv/lib/python2.7/site-packages/celery/bootsteps.py\", line 123, in start\r\n    step.start(parent)\r\n  File \"venv/lib/python2.7/site-packages/celery/bootsteps.py\", line 374, in start\r\n    return self.obj.start()\r\n  File \"venv/lib/python2.7/site-packages/celery/worker/consumer.py\", line 278, in start\r\n    blueprint.start(self)\r\n  File \"venv/lib/python2.7/site-packages/celery/bootsteps.py\", line 123, in start\r\n    step.start(parent)\r\n  File \"venv/lib/python2.7/site-packages/celery/worker/consumer.py\", line 478, in start\r\n    c.connection = c.connect()\r\n  File \"venv/lib/python2.7/site-packages/celery/worker/consumer.py\", line 375, in connect\r\n    callback=maybe_shutdown,\r\n  File \"venv/lib/python2.7/site-packages/kombu/connection.py\", line 369, in ensure_connection\r\n    interval_start, interval_step, interval_max, callback)\r\n  File \"venv/lib/python2.7/site-packages/kombu/utils/__init__.py\", line 243, in retry_over_time\r\n    return fun(*args, **kwargs)\r\n  File \"venv/lib/python2.7/site-packages/kombu/connection.py\", line 237, in connect\r\n    return self.connection\r\n  File \"venv/lib/python2.7/site-packages/kombu/connection.py\", line 741, in connection\r\n    self._connection = self._establish_connection()\r\n  File \"venv/lib/python2.7/site-packages/kombu/connection.py\", line 696, in _establish_connection\r\n    conn = self.transport.establish_connection()\r\n  File \"venv/lib/python2.7/site-packages/kombu/transport/virtual/__init__.py\", line 809, in establish_connection\r\n    self._avail_channels.append(self.create_channel(self))\r\n  File \"venv/lib/python2.7/site-packages/kombu/transport/virtual/__init__.py\", line 791, in create_channel\r\n    channel = self.Channel(connection)\r\n  File \"venv/lib/python2.7/site-packages/kombu/transport/mongodb.py\", line 91, in __init__\r\n    self._create_client()\r\n  File \"venv/lib/python2.7/site-packages/kombu/transport/mongodb.py\", line 257, in _create_client\r\n    self._open()\r\n  File \"venv/lib/python2.7/site-packages/kombu/transport/mongodb.py\", line 182, in _open\r\n    use_greenlets=_detect_environment() != 'default',\r\n  File \"build/bdist.linux-x86_64/egg/pymongo/mongo_client.py\", line 366, in __init__\r\n    self._ensure_connected(True)\r\n  File \"build/bdist.linux-x86_64/egg/pymongo/mongo_client.py\", line 930, in _ensure_connected\r\n    self.__ensure_member()\r\n  File \"build/bdist.linux-x86_64/egg/pymongo/mongo_client.py\", line 793, in __ensure_member\r\n    self.__event_class)\r\n  File \"build/bdist.linux-x86_64/egg/pymongo/thread_util.py\", line 195, in __init__\r\n    self._event = event_class()\r\n  File \"build/bdist.linux-x86_64/egg/pymongo/mongo_client.py\", line 346, in <lambda>\r\n    event_class = lambda: thread_util.create_event(g)\r\n  File \"build/bdist.linux-x86_64/egg/pymongo/thread_util.py\", line 340, in create_event\r\n    return GeventEvent()\r\nNameError: global name 'GeventEvent' is not defined\r\n```\r\n\r\nmongodb transport creates MongoClient with use_greenlets = True when either gevent or eventlet is installed\r\nhttps://github.com/celery/kombu/blob/39a6491013fc35325bfb0517e5343a2f7d32aa31/kombu/transport/mongodb.py#L186\r\nhttps://github.com/celery/kombu/blob/39a6491013fc35325bfb0517e5343a2f7d32aa31/kombu/syn.py#L23-L46\r\n\r\npymongo assumes you're using gevent when use_greenlets equals True\r\nhttps://github.com/mongodb/mongo-python-driver/blob/master/pymongo/thread_util.py#L338-L340\r\n"}}
{"actor":{"display_login":"ask"}}