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

Specify connection timeout for blocking calls #426

Closed
vdichev opened this issue May 16, 2013 · 6 comments · Fixed by #2028
Closed

Specify connection timeout for blocking calls #426

vdichev opened this issue May 16, 2013 · 6 comments · Fixed by #2028

Comments

@vdichev
Copy link

vdichev commented May 16, 2013

In some scenarios the TCP connection in blocking calls like brpop, blpop and brpoplpush gets stalled (netstat shows it as ESTABLISHED on the client side, but gone on the server side). In this case it would be beneficial to be able to specify a connection timeout, but blocking calls set it to infinite. I know that it's necessary in issue #108, but it should be possible to be able to set this timeout at least for calls that specify a timeout.

I suggest that for calls that specify a timeout this value (or a slightly larger one) is set for the connection timeout as well.

@marcosnils
Copy link
Contributor

This is supported already

@vdichev
Copy link
Author

vdichev commented Jul 15, 2015

I kindly suggest that until the call to "client.setTimeoutInfinite()" in https://github.com/xetorthio/jedis/blob/master/src/main/java/redis/clients/jedis/Jedis.java is gone, this issue is not resolved. If you do a quick search, you'll find that the following methods contain it:

  • blpop
  • brpop
  • brpoplpush
  • eval
  • subscribe
  • psubscribe

@maheshdatt
Copy link

Thanks for reopening this issue - We currently are working on a local fix. I could possibly do a PR for you to review. Let me know.

@maheshdatt
Copy link

I have forked jedis and made this change to support socket timeout - can you please check and let me know if you have any comments?

maheshdatt#1

@a8156268
Copy link

On a forced outage of redis server, our team also encountered this problem.
Redis server was restarted, while client was blocking infinite.
Is the problem being solved?

@JerryChin
Copy link

I bump into this problem today while doing some code reviewing on our codebase.

JedisPubSub which is heavily used in our system, seems also suffered from this issue.

It cripples our connection mechanism, if master is hard rebooted, the subscription thread will block forever, we're not able to switch to the newly-elected master by leveraging JedisSentinelPool, isn't a very serious problem?

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 a pull request may close this issue.

6 participants