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

SocketIO with redis sentinel message_queue #359

Closed
Negashev opened this issue Nov 15, 2016 · 5 comments
Closed

SocketIO with redis sentinel message_queue #359

Negashev opened this issue Nov 15, 2016 · 5 comments

Comments

@Negashev
Copy link

I have load balancer for my sentinels and try to connect socketIO with sentinel

app = Flask(__name__)
socketio = SocketIO(
    app, message_queue='sentinel://sentinel:26379')
)

and i get error with master

Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/kombu/transport/virtual/base.py", line 921, in create_channel
    return self._avail_channels.pop()
IndexError: pop from empty list

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/redis/client.py", line 572, in execute_command
    connection.send_command(*args)
  File "/usr/local/lib/python3.5/site-packages/redis/connection.py", line 563, in send_command
    self.send_packed_command(self.pack_command(*args))
  File "/usr/local/lib/python3.5/site-packages/redis/connection.py", line 538, in send_packed_command
    self.connect()
  File "/usr/local/lib/python3.5/site-packages/redis/sentinel.py", line 44, in connect
    self.connect_to(self.connection_pool.get_master_address())
  File "/usr/local/lib/python3.5/site-packages/redis/sentinel.py", line 100, in get_master_address
    self.service_name)
  File "/usr/local/lib/python3.5/site-packages/redis/sentinel.py", line 222, in discover_master
    raise MasterNotFoundError("No master found for %r" % (service_name,))
redis.sentinel.MasterNotFoundError: No master found for None

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.5/site-packages/socketio/pubsub_manager.py", line 126, in _thread
    for message in self._listen():
  File "/usr/local/lib/python3.5/site-packages/socketio/kombu_manager.py", line 69, in _listen
    with self._connection().SimpleQueue(reader_queue) as queue:
  File "/usr/local/lib/python3.5/site-packages/kombu/connection.py", line 736, in SimpleQueue
    exchange_opts, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/kombu/simple.py", line 118, in __init__
    consumer = messaging.Consumer(channel, queue)
  File "/usr/local/lib/python3.5/site-packages/kombu/messaging.py", line 383, in __init__
    self.revive(self.channel)
  File "/usr/local/lib/python3.5/site-packages/kombu/messaging.py", line 396, in revive
    channel = self.channel = maybe_channel(channel)
  File "/usr/local/lib/python3.5/site-packages/kombu/connection.py", line 973, in maybe_channel
    return channel.default_channel
  File "/usr/local/lib/python3.5/site-packages/kombu/connection.py", line 819, in default_channel
    self.connection
  File "/usr/local/lib/python3.5/site-packages/kombu/connection.py", line 802, in connection
    self._connection = self._establish_connection()
  File "/usr/local/lib/python3.5/site-packages/kombu/connection.py", line 757, in _establish_connection
    conn = self.transport.establish_connection()
  File "/usr/local/lib/python3.5/site-packages/kombu/transport/virtual/base.py", line 941, in establish_connection
    self._avail_channels.append(self.create_channel(self))
  File "/usr/local/lib/python3.5/site-packages/kombu/transport/virtual/base.py", line 923, in create_channel
    channel = self.Channel(connection)
  File "/usr/local/lib/python3.5/site-packages/kombu/transport/redis.py", line 501, in __init__
    self.client.ping()
  File "/usr/local/lib/python3.5/site-packages/redis/client.py", line 682, in ping
    return self.execute_command('PING')
  File "/usr/local/lib/python3.5/site-packages/redis/client.py", line 578, in execute_command
    connection.send_command(*args)
  File "/usr/local/lib/python3.5/site-packages/redis/connection.py", line 563, in send_command
    self.send_packed_command(self.pack_command(*args))
  File "/usr/local/lib/python3.5/site-packages/redis/connection.py", line 538, in send_packed_command
    self.connect()
  File "/usr/local/lib/python3.5/site-packages/redis/sentinel.py", line 44, in connect
    self.connect_to(self.connection_pool.get_master_address())
  File "/usr/local/lib/python3.5/site-packages/redis/sentinel.py", line 100, in get_master_address
    self.service_name)
  File "/usr/local/lib/python3.5/site-packages/redis/sentinel.py", line 222, in discover_master
    raise MasterNotFoundError("No master found for %r" % (service_name,))
redis.sentinel.MasterNotFoundError: No master found for None

use docker image python:3-alpine and installed

flask
redis
raven[flask]
flask-socketio
Flask-Env
flask-cors
flask-sqlalchemy
crate
oauth2client
celery
@miguelgrinberg
Copy link
Owner

What version of kombu do you have installed?

@Negashev
Copy link
Author

@miguelgrinberg

 # cat /usr/local/lib/python3.5/site-packages/kombu/__init__.py
"""Messaging library for Python."""
from __future__ import absolute_import, unicode_literals

import os
import re
import sys

if sys.version_info < (2, 7):  # pragma: no cover
    raise Exception('Kombu 4.0 requires Python versions 2.7 or later.')

from collections import namedtuple  # noqa

__version__ = '4.0.0'
__author__ = 'Ask Solem'
__contact__ = 'ask@celeryproject.org'
__homepage__ = 'https://kombu.readthedocs.io'
__docformat__ = 'restructuredtext en'

@miguelgrinberg
Copy link
Owner

I haven't used the new 4.0 releases of Celery and Kombu myself, I wonder if they have some issues there that need to be worked out. Could you give the latest 3.x version a try? The stack trace seems to point to a Kombu issue, this is probably something that needs to be reported to them.

@Negashev
Copy link
Author

@miguelgrinberg Kombu 3.x does not exist sentinel :(. Open issue in kombu, Thanks!

@edgarmarkosov
Copy link

I also have such issue while connecting to the sentinel. They require master_name param in the transport_options, but I can not provide it. How can I do that?

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

No branches or pull requests

3 participants