gregoriusxu / booksleeve

Automatically exported from code.google.com/p/booksleeve
Other
0 stars 0 forks source link

RedisSubscriberConnection doesn't implement KeepAlive Feature #57

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create RedisConnection and enable KeepAlive by calling SendKeepAlive with 5 
seconds interval
2. Connect and Subscribe to a channel using that RedisConnection
3. Keep the program open for a few hours
3. Publish a message to the subscribed channel using any redis client

What is the expected output? What do you see instead?
The subscriber should receive the message but it never receive the message

What version of the product are you using? On what operating system?
BookSleeve Version 1.3.38, Windows 2008 R2

Please provide any additional information below.

We found out RedisSubscriberConnection doesn't implement keepAlive feature.

In our production environment, our redis client subscriber didn't receive any 
message after a few hours of idle time (no message is published to the 
subscribed channel). When we checked the TCP connections on both client and 
server sides using Process Explorer and tcpview from SysInternal, we found that 
the underlying TCP connection of "RedisSubscriberConnection" no longer existed 
in Redis server but in client side, it still connected to the server IP. That 
may be because of Routers between client and server that closed the idle TCP 
connection but the client didn't detect that the closed connection since it 
never sends any message through that connection.

So I need to enable KeepAlive feature in the RedisSubscriberConnection. 
Currently it is only the RedisConnection that can be configured to enable 
KeepAlive either by calling SendKeep method manually or setting a timeout 
option at Redis server.

Original issue reported on code.google.com by tunt...@gmail.com on 26 Mar 2014 at 10:34

GoogleCodeExporter commented 8 years ago
The pub/sub protocol does not actually allow a ping as such, but there are ways 
to spoof it. Using this spoofing, this feature is already implemented in 
StackExchange.Redis, the successor to BookSleeve (see 
http://marcgravell.blogspot.co.uk/2014/03/so-i-went-and-wrote-another-redis-clie
nt.html). Separately, I have also logged with redis the *opposite* issue - the 
issue of long-dead client connections remaining listed on the redis server 
forever (from subscribers), and subsequently it is possible that at some point 
soon redis will have first-class keep-alive support in the not too distant 
future. If and when that happens, support for this will be extended into 
StackExchange.Redis.

I strongly advise you consider migrating to StackExchange.Redis:

- this feature is built in *today*
- StackExchange.Redis also supports fully automatic reconnection if a socket 
dies, including automatic re-subscription
- all future development will be focused on StackExchange.Redis, not BookSleeve

(I do not propose to retroactively apply this change to BookSleev)

Original comment by marc.gravell on 26 Mar 2014 at 11:19

GoogleCodeExporter commented 8 years ago

Original comment by marc.gravell on 27 Mar 2014 at 9:37