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

attempt to fix #1965 analogously for epoll #342

Closed
wants to merge 1 commit into from
Closed

attempt to fix #1965 analogously for epoll #342

wants to merge 1 commit into from

Conversation

tbg
Copy link

@tbg tbg commented Apr 19, 2014

this should hopefully take care of the error's I've recently seen with a prefork based worker, which seemed analogous to #1965 in gevent

@stevedh
Copy link

stevedh commented Apr 21, 2014

We're also hitting this using the redis broker on Ubuntu 12.04 -- I haven't dug in enough to check if the proposed patch.

>>> celery.__version__, kombu.__version__
('3.1.11', '3.0.15')
  File "/home/ubuntu/develop/venv/local/lib/python2.7/site-packages/celery/beat.py", line 203, in maybe_due
    result = self.apply_async(entry, publisher=publisher)
...
  File "/home/ubuntu/develop/venv/local/lib/python2.7/site-packages/redis/client.py", line 1130, in smembers
    return self.execute_command('SMEMBERS', name)
  File "/home/ubuntu/develop/venv/local/lib/python2.7/site-packages/redis/client.py", line 396, in execute_command
    connection.disconnect()
  File "/home/ubuntu/develop/venv/local/lib/python2.7/site-packages/kombu/transport/redis.py", line 800, in disconnect
    channel._on_connection_disconnect(self)
  File "/home/ubuntu/develop/venv/local/lib/python2.7/site-packages/kombu/transport/redis.py", line 461, in _on_connection_disconnect
    self.connection.cycle._on_connection_disconnect(connection)
  File "/home/ubuntu/develop/venv/local/lib/python2.7/site-packages/kombu/transport/redis.py", line 259, in _on_connection_disconnect
    self.poller.unregister(connection._sock)
  File "/home/ubuntu/develop/venv/local/lib/python2.7/site-packages/kombu/utils/eventio.py", line 85, in unregister
    self._epoll.unregister(fd)
SchedulingError: Couldn't apply scheduled task monitoring-daily-email: argument must be an int, or have a fileno() method.

FWIW, downgrading to

>>> celery.__version__, kombu.__version__
('3.1.9', '3.0.13')

Seems to work around the problem.

@tspike
Copy link

tspike commented Apr 23, 2014

I was getting similar intermittent errors using 3.1.11 and 3.0.15 and the redis broker:

Traceback (most recent call last):
  File "/code/flask/local/lib/python2.7/site-packages/celery/canvas.py", line 167, in delay
    return self.apply_async(partial_args, partial_kwargs)
  File "/code/flask/local/lib/python2.7/site-packages/celery/canvas.py", line 241, in apply_async
    return _apply(args, kwargs, **options)
  File "/code/flask/local/lib/python2.7/site-packages/celery/app/task.py", line 555, in apply_async
    **dict(self._get_exec_options(), **options)

...

  File "/code/flask/local/lib/python2.7/site-packages/kombu/transport/redis.py", line 461, in _on_connection_disconnect
    self.connection.cycle._on_connection_disconnect(connection)
  File "/code/flask/local/lib/python2.7/site-packages/kombu/transport/redis.py", line 259, in _on_connection_disconnect
    self.poller.unregister(connection._sock)
  File "/code/flask/local/lib/python2.7/site-packages/kombu/utils/eventio.py", line 85, in unregister
    self._epoll.unregister(fd)
TypeError: argument must be an int, or have a fileno() method.

From limited testing, downgrading to 3.1.9 and 3.0.13 per @stevedh's suggestion appears to have worked for me as well.

@zachsnow
Copy link

Also recently started running into this. It seems like in this case connection._sock might be None?

@ask
Copy link
Contributor

ask commented Apr 28, 2014

@zachsnow does the proposed patch work for you?

@zachsnow
Copy link

@ask I haven't had a chance yet; the only place that I can reproduce is production unfortunately.

I would expect that changing this code (https://github.com/celery/kombu/blob/master/kombu/transport/redis.py#L257) to check for connection._sock is None before unregistering might swallow less errors but still work; if I manage to reproduce somewhere that I can test changes I will let you know / generate a pull request.

@ask
Copy link
Contributor

ask commented Apr 29, 2014

Thanks! Merged into master

ask added a commit that referenced this pull request Apr 29, 2014
@tbg
Copy link
Author

tbg commented Apr 29, 2014

thanks @ask! I'm closing this as it's likely not needed any more. Will give the new code a shot asap.

@ask
Copy link
Contributor

ask commented May 6, 2014

Fixed in Kombu 3.0.16 out on PyPI now!

@zachsnow
Copy link

zachsnow commented May 6, 2014

@ask great I'll give it a try. Thanks!

hpiwowar added a commit to ourresearch/total-impact-webapp that referenced this pull request Jun 15, 2014
hpiwowar added a commit to ourresearch/total-impact-webapp that referenced this pull request Jun 15, 2014
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 this pull request may close these issues.

None yet

5 participants