1

I have set up an instance to use as a redis worker. All ports are open. When i issue

library("doRedis")
redisWorker(host="ZZZ-23-20-XXX-XXX.compute-1.amazonaws.com", queue="jobs")

i get the error

Error in socketConnection(host, port, open = "a+b", blocking = TRUE, timeout = timeout) : 
  cannot open the connection
In addition: Warning message:
In socketConnection(host, port, open = "a+b", blocking = TRUE, timeout = timeout) :
  ZZZ-23-20-XXX-XXX.compute-1.amazonaws.com:6379 cannot be opened

Any ideas what could be going on? I have also used the inernal EC2 IP (10.XXX.XXX.ZZZ) still get the same error. The server is up, running and pingable

I am running latest and greatest of R, doRedis,Ubuntu 12.04 all fully updated. This has been discussed before but no solution found. doRedis with strange socket connection error in Ubuntu Linux, R, and RStudio

Community
  • 1
  • 1
ECII
  • 10,297
  • 18
  • 80
  • 121

1 Answers1

2

I have had similar issues although with registerDoRedis() as you cannot set a timeout and I believe the problem is with the timeout value used in the function 'redisConnect'.

In R if you run fix(redisConnect) and you can see the default for timeout is as follows:

redisConnect <- function (host = "localhost", port = 6379, returnRef = FALSE, timeout = 2147483647L)

It seems this huge timeout value is causing the issue. To check change it on the line it is used from this:

con <- socketConnection(host, port, open = "a+b", blocking = TRUE, 
    timeout = timeout)

To this:

con <- socketConnection(host, port, open = "a+b", blocking = TRUE, 
    timeout = 30)

I find that works although as soon as you reload the package the change gets wiped. I just found this today so will submit a bug to the developer. I'm running R 2.15 on OSX by the way.

The function you are using should default to timeout 30, or you can try setting it on the function call to be sure rather than fix()'ing the underlying code.