ledgetech / lua-resty-redis-connector

Connection utilities for lua-resty-redis
236 stars 71 forks source link

closed socket when I enable set_keepalive #31

Open ghost opened 5 years ago

ghost commented 5 years ago

This is my config:

local rc = require("resty.redis.connector").new({
                connect_timeout = 50,
                read_timeout = 5000,
                keepalive_timeout = 30000
            })

            local redis, err1 = rc:connect({
                url = "redis://127.0.0.1:6379",
            })

            if not redis then
                ngx.say( err1)    
            else
                ngx.say('connection fine')    
            end

            local ok, err = rc:set_keepalive(redis)  

I'm getting this error: [error] 4044#0: *1068056 attempt to send data on a closed socket: u:00007F2BABA05D48, c:0000000000000000, ft:0 eof:0, client: MY IP, server: , request: "GET /foo HTTP/1.1", host: "SERVER IP"

When I disable keepalive setting, get this error: [error] 4147#0: *1089971 lua tcp socket connect timed out, when connecting to 127.0.0.1:6379,

When I comment out the line related to rc:set_keepalive it works on single requests and crashes on 100 requests.

vento-vt commented 4 years ago

Try to check redis.conf Use the solution that was suggested here: https://github.com/openresty/lua-resty-redis/issues/140