Resource temporarily unavailable - Timeout reading from the socket

1,790 views
Skip to first unread message

Rob Watson

unread,
Jun 27, 2011, 5:19:42 AM6/27/11
to redi...@googlegroups.com
Hi list

I'm experiencing a problem with the following error occuring at seemingly random times:

Resource temporarily unavailable - Timeout reading from the socket

I use Redis clients both in Ruby on Rails (running on Unicorn), for which each process has its own Redis connection. I also have Java clients connected to the same server, using Jedis' connection pool which should also be thread-safe.

When the timeout errors occur, they affect both the Ruby and Java clients, and cause them both to raise socket-related exceptions. 

They don't seem to occur under especially heavy load, just at random times. They affect clients both on remote boxes, and on the same server as our Redis server.

I suspect there are timeout settings I can set to help here: can anybody help/advise?

thanks
Rob

kajisaap

unread,
Mar 12, 2012, 4:03:47 AM3/12/12
to redi...@googlegroups.com
Were you able to solve this ? We seem to be same situation and we could not find any solid answer.


bikash

Damian Janowski

unread,
Mar 12, 2012, 10:43:36 AM3/12/12
to redi...@googlegroups.com
On Mon, Jun 27, 2011 at 6:19 AM, Rob Watson <rfwa...@gmail.com> wrote:
> Hi list
>
> I'm experiencing a problem with the following error occuring at seemingly
> random times:
>
> Resource temporarily unavailable - Timeout reading from the socket
>
> I use Redis clients both in Ruby on Rails (running on Unicorn), for which
> each process has its own Redis connection. I also have Java clients
> connected to the same server, using Jedis' connection pool which should also
> be thread-safe.

Is Unicorn configured to reconnect to Redis after forking its child
processes? As in
https://github.com/ezmobius/redis-rb/blob/master/examples/unicorn/unicorn.rb

> When the timeout errors occur, they affect both the Ruby and Java clients,
> and cause them both to raise socket-related exceptions.

Could it be that you're hitting an I/O bottleneck by saving or
rewriting the AOF?

Pieter Noordhuis

unread,
Mar 12, 2012, 5:48:02 PM3/12/12
to redi...@googlegroups.com
Hi Rob,

When you have both Ruby (redis-rb) processes and Java (jedis)
processes timing out, I suspect your Redis server may be stalling at
some point. This can cause active connections to timeout when this
timeout is lower than the time the server stalls. You can monitor
latency with the `redis-stat` tool from the `redis-tools` repository.
This repository hasn't been updated for a while, but the latency
monitoring tool works fine. If you see any spikes here (monitored from
the machines that host the Redis clients) you'll know that it isn't
related to the client code. If you see spikes when monitored from the
same machine where the Redis server is running, you'll know that it
stalls for some other reason. This can be due to forking a child to
save the RDB or rewrite the AOF, or because of executing commands that
simply take a long time to run. If you run Redis 2.6, you'll have
access to the SLOWLOG command which can provide insight into commands
that take a long time to run.

Cheers,
Pieter

> --
> You received this message because you are subscribed to the Google Groups "Redis DB" group.
> To post to this group, send email to redi...@googlegroups.com.
> To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.
>

Pieter Noordhuis

unread,
Mar 12, 2012, 5:51:38 PM3/12/12
to redi...@googlegroups.com
And, take a look at http://redis.io/topics/latency for additional
information on finding out sources of latency.

Cheers,
Pieter

Reply all
Reply to author
Forward
0 new messages