Closed subwiz closed 12 years ago
That's due to a connection timeout. Java does not raise an error on a dropped connection on send and it's only on the read end that you get a -1 returned (with semantics as defined in the javadocs e.g. "connection reset"). What is the timeout value in redis conf?
It is set at 300 seconds in redis.conf.
This could also be due to the way I implemented Connection management---using ThreadLocal. So I will verify if there are any connections open in my side for more than 300 seconds.
Thanks for the pointer.
NP; happy to help. I assumed you were pooling connections; can you confirm?
I was believing that I have to manually pool connections..., so I implemented my logic based on a Servlet Filter which creates a new Redis connection, and throughout this particular request flow, this connection is used. Is there a better approach for pooling connections?
hmm. If you have a connection per request, then why would it even be idle for > 300s ??
I have to run some test if my implementation of ThreadLocal is holding connections open. So do you know of any OpenSource connection pool library for JRedis?
I added few logs to my application and see that it is indeed timeout problem. Now I have pointer to work on this issue independently. I am closing this issue because this is not a JRedis bug.
Thanks a lot for the pointer.
Reopening as documentation issue.
Closing this. The javadoc for the exception states explicitly this is "typically due to timeout on Redis side".
Can this also be added as part of Exception message?
This is the trace:
This is happening on random basis. I am using the latest jredis from trunk ( https://github.com/alphazero/jredis/commit/2c58286959a65617f71dbbb9d8d155c6722aab59 ) and using Redis 2.2.12.