bwlewis / rredis

R client for Redis
http://illposed.net/
93 stars 25 forks source link

"Error in readBin(con, raw(), 1000000L) : negative length vectors are not allowed" issued incorrectly #24

Open telenskyt opened 10 years ago

telenskyt commented 10 years ago

I got this response from redisKeys

$ redisKeys("*") Error in readBin(con, raw(), 1000000L) : negative length vectors are not allowed

According to https://github.com/bwlewis/doRedis/issues/4, this error message should be issued when exceeding the data size limit. But this is definitely not the case of redisKeys. There was probably some error around the connection, because after I connected again, I got the correct response with no error:

$ redisConnect('myserver') $ redisKeys("*") [1] "jobs:1.alive.1" "x" "jobs:counter" "jobs:1.start.3" "jobs:1.alive.3" [6] "jobs" "jobs:1" "jobs:1.start.1" "jobs:workers" "jobs:1.env"

So there should probably be a different error message issued in this case.

telenskyt commented 10 years ago

Yes, this error message appears in situation when there is a problem with server connection. I tried to stop the server and then call redisConnect, and I got the same response:

redisConnect(host = "my_server")
# Error:  Error in readBin(con, raw(), 1000000L): negative length vectors are not allowed

So probably something like "Error connecting the server 'my_server'" should be reported instead of this unreadable and confusing error message.