{"action":"created","issue":{"url":"https://api.github.com/repos/xetorthio/jedis/issues/1036","labels_url":"https://api.github.com/repos/xetorthio/jedis/issues/1036/labels{/name}","comments_url":"https://api.github.com/repos/xetorthio/jedis/issues/1036/comments","events_url":"https://api.github.com/repos/xetorthio/jedis/issues/1036/events","html_url":"https://github.com/xetorthio/jedis/issues/1036","id":90039003,"number":1036,"title":"'ERR max number of clients reached' in JedisSentinelPool.initSentinels breaks the pool initialization","user":{"login":"Foxlik","id":5588577,"avatar_url":"https://avatars.githubusercontent.com/u/5588577?v=3","gravatar_id":"","url":"https://api.github.com/users/Foxlik","html_url":"https://github.com/Foxlik","followers_url":"https://api.github.com/users/Foxlik/followers","following_url":"https://api.github.com/users/Foxlik/following{/other_user}","gists_url":"https://api.github.com/users/Foxlik/gists{/gist_id}","starred_url":"https://api.github.com/users/Foxlik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Foxlik/subscriptions","organizations_url":"https://api.github.com/users/Foxlik/orgs","repos_url":"https://api.github.com/users/Foxlik/repos","events_url":"https://api.github.com/users/Foxlik/events{/privacy}","received_events_url":"https://api.github.com/users/Foxlik/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-06-22T08:09:11Z","updated_at":"2015-06-29T15:16:46Z","closed_at":null,"body":"If, during the sentinel initialization, one of the sentinels rejects the connection attempt with \r\n\r\n    redis.clients.jedis.exceptions.JedisDataException: ERR max number of clients reached\r\n\r\nthe whole pool initialization fails.\r\n\r\nIt seems, that in the process of sentinel pool initialization, every sentinel is tried, regardless of whether master has been found or not. And, the initialization only catches JedisConnectionException, while `max number of clients reached` throws JedisDataException. So even if one of three sentinels returns this error during initialization, the whole process fails.\r\n\r\nhttps://github.com/xetorthio/jedis/blob/master/src/main/java/redis/clients/jedis/JedisSentinelPool.java#L145\r\n\r\nChanging the catch clause to `JedisException` should fix the problem, but I am not sure that is the right way to fix things."},"comment":{"url":"https://api.github.com/repos/xetorthio/jedis/issues/comments/116727765","html_url":"https://github.com/xetorthio/jedis/issues/1036#issuecomment-116727765","issue_url":"https://api.github.com/repos/xetorthio/jedis/issues/1036","id":116727765,"user":{"login":"marcosnils","id":1578458,"avatar_url":"https://avatars.githubusercontent.com/u/1578458?v=3","gravatar_id":"","url":"https://api.github.com/users/marcosnils","html_url":"https://github.com/marcosnils","followers_url":"https://api.github.com/users/marcosnils/followers","following_url":"https://api.github.com/users/marcosnils/following{/other_user}","gists_url":"https://api.github.com/users/marcosnils/gists{/gist_id}","starred_url":"https://api.github.com/users/marcosnils/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcosnils/subscriptions","organizations_url":"https://api.github.com/users/marcosnils/orgs","repos_url":"https://api.github.com/users/marcosnils/repos","events_url":"https://api.github.com/users/marcosnils/events{/privacy}","received_events_url":"https://api.github.com/users/marcosnils/received_events","type":"User","site_admin":false},"created_at":"2015-06-29T15:16:46Z","updated_at":"2015-06-29T15:16:46Z","body":"@HeartSaVioR  the idea of  sending \"hidden\" commands just to check the sanity of the Jedis instance gives me goosebumps :smile: . \r\n\r\nMaybe instead of doing this we can finally start thinking of a proper way to reset a jedis state so it can be reused (reconnect) if a connection error occurs. \r\n"}}