Redis EOF after a period of time

1,607 views
Skip to first unread message

Mihail Sizov

unread,
Aug 10, 2018, 11:31:34 AM8/10/18
to Redis DB
Hi, guys!

I faced with the fully similar issue that described here but in my case I'm not using a timeout option on the server (using a default zero value - that mean the server doesn't close a idle connections), and client using a default 5 min timeout. But some times (probably every 20-30 sec) client returns a EOF error without any essential reasons (no high loading, no network problems etc.). As I understood EOF error appears in case when server has closed a connection, but client is still not.

So, what is the reasons of EOF error could be? What is the suggested way to re-connect and to avoid fails for the initial request?
Thanks,
Mike

hva...@gmail.com

unread,
Aug 10, 2018, 1:23:11 PM8/10/18
to Redis DB
As I understood EOF error appears in case when server has closed a connection, but client is still not.

The server has not necessarily closed the connection.  A network device between the client and server may have timed out and flushed the connection information and is now dropping the network packets that the client is sending over that connection.  This is a fairly common occurrence when clients become idle (don't exchange commands/packets with the server).  The server usually believes the connection is still open because it's passive, waiting for the next command from the client.  The client detects the problem when it attempts to send the next command and gets no response from the server.

The network devices that will time out idle TCP connections and drop their info and packets are typically things that perform address translation (NAT/DNAT/SNAT) between "inside" private IP addresses and "outside" public IP addresses.  Load balancers, Routers in certain configurations, Proxy servers.

The usual way to defeat these devices timing out on idle connections is to prevent the connection from being idle.  The client sends a do-nothing command like PING to the server through the connection (receiving the reply PONG) every so often - 30 seconds perhaps - so the network devices see the connection is active and not idle.

Check the documentation for the client libraries you're using to see if it will do this for you.
Reply all
Reply to author
Forward
0 new messages