Incorrect error message `MasterNotFoundError: No master found for 'pre'` when timeout.

See original GitHub issue

Version: 2.10.6 Platform: 3.6 on win 10

Description:

if socket_timeout=0.1 :

sentinel = Sentinel([("192.168.0.10", 26379),("192.168.0.11", 26379),("192.168.0.12", 26379)], password='xxxxxx', socket_timeout=0.1)
sentinel.discover_master('pre')

got error:

C:\Anaconda3\lib\site-packages\redis\sentinel.py in discover_master(self, service_name)
    221                     sentinel, self.sentinels[0])
    222                 return state['ip'], state['port']
--> 223         raise MasterNotFoundError("No master found for %r" % (service_name,))
    224
    225     def filter_slaves(self, slaves):

MasterNotFoundError: No master found for 'pre'

But remove socket_timeout :

sentinel = Sentinel([("192.168.0.10", 26379),("192.168.0.11", 26379),("192.168.0.12", 26379)], password='xxxxxx')
sentinel.discover_master('pre')

got ('192.168.0.12', 6316)

This misleading message waste me lot of time .

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
Cimmanuelcommented, Jun 3, 2022

Getting the same error when i try to configure with airflow celery AIRFLOW__CELERY__BROKER_URL=“sentinel://$SENTINEL_HOST:$SENTINEL_PORT” AIRFLOW__CELERY_BROKER_TRANSPORT_OPTIONS={‘master_name’:“mymaster”}

Resolved!

How did you solve this please?

1reaction
andymccurdycommented, Mar 2, 2020

Setting socket_timeout configures the socket to raise a timeout after socket_timeout seconds have elapsed. Setting this value too low for your environment will cause every command to a Redis or Sentinel server to timeout.

In this particular case, the redis-py Sentinel code catches the TimeoutError and tries the next Sentinel server. If none of the Sentinel servers respond, the MasterNotFoundError is raised.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Incorrect error message `MasterNotFoundError: No master ...
In this particular case, the redis-py Sentinel code catches the TimeoutError and tries the next Sentinel server. If none of the Sentinel servers ......
Read more >
MasterNotFoundError using redis-py when connecting to ...
I face the redis.sentinel.MasterNotFoundError: No master found for 'mymaster' error. How can I solve this? Thanks. python ...
Read more >
Strange Issue: from redis-py client
I have two redis-servers instances running at port 6379, 6380 on the same box and ... MasterNotFoundError: No master found for 'mymaster' ...
Read more >
redis 2.10.6
If no server is found, a MasterNotFoundError or SlaveNotFoundError is raised. Both exceptions are subclasses of ConnectionError. When trying to connect to a ......
Read more >
Videoder apk direct for pc
external command, 'React/RCTEventDispatcher.h' file not found ... error: refname refs/heads/master not found error: refs/remotes/origin/PLAT-4366 does not ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found