Sorry, I sent the bug report incomplete.
The problem is that the lua-redis package does not close the file
descriptors when calling redis quit or shutdown. Here in this report to the
upstream is the problem explained https://github.com/nrk/redis-lua/issues/71
I detected the problem when running the software kamailio-proxy. After
running some time I got this error
ERROR: app_lua [app_lua_api.c:719]: app_lua_run_ex(): error from Lua:
/usr/share/lua/5.1/redis.lua:813: could not connect to 127.0.0.1:6379 [Too
many open files]
When running a lsof there where a lot of this entries:
kamailio 2205 kamailio 4u sock 0,8
0t0 33760 protocol: TCP
kamailio 2205 kamailio 13u sock 0,8
0t0 33758 protocol: TCP
kamailio 2205 kamailio 17u sock 0,8
0t0 130221 protocol: TCP
kamailio 2205 kamailio 18u sock 0,8
0t0 130222 protocol: TCP
kamailio 2205 kamailio 19u sock 0,8
0t0 143025 protocol: TCP
To reproduce the problem I wrote a lua script, to use first
ulimit -m 1024
lua pe.lua
...
uccessfully connected and pinged Redis. Total connections: 1018
Successfully connected and pinged Redis. Total connections: 1019
Successfully connected and pinged Redis. Total connections: 1020
Successfully connected and pinged Redis. Total connections: 1021
Error connecting to Redis: /usr/share/lua/5.3/redis.lua:810: could not
connect to 127.0.0.1:6379 [Too many open files]
Reached the maximum open files limit. Sleeping for 10 hours...
The script is:
local redis = require "redis" -- Ensure this library is installed
(lua-redis)
local socket = require "socket" -- For sleeping
local redis_host = "127.0.0.1"
local redis_port = 6379
local connection_counter = 0 -- Initialize connection counter
local client_list = {} -- Initialize an array to store all client
connections