You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The two methods on the client that permit 'disconnecting' from redis are :quit() and :shutdown(). However, both of them only call :shutdown() on the underlying luasocket socket:
client_prototype.quit = function(client)
request.multibulk(client, 'QUIT')
client.network.socket:shutdown()
return true
end
client_prototype.shutdown = function(client)
request.multibulk(client, 'SHUTDOWN')
client.network.socket:shutdown()
end
This causes a socket shutdown - but at least on Linux that is not enough to also close the file descriptor used by the socket. This in turn means that every connection to Redis, even if closed via :close() or :shutdown(), leaks a file descriptor.
One way to fix this would be to call :close() on the underlying luasocket instead of :shutdown() in client:quit and client:shutdown.
Here's an strace of a Lua program using redis-lua opening a Redis connection, calling :quit() on the client, then reopening another connection, showing the FD leak:
The two methods on the client that permit 'disconnecting' from redis are :quit() and :shutdown(). However, both of them only call :shutdown() on the underlying luasocket socket:
This causes a socket shutdown - but at least on Linux that is not enough to also close the file descriptor used by the socket. This in turn means that every connection to Redis, even if closed via :close() or :shutdown(), leaks a file descriptor.
One way to fix this would be to call :close() on the underlying luasocket instead of :shutdown() in client:quit and client:shutdown.
Here's an strace of a Lua program using redis-lua opening a Redis connection, calling :quit() on the client, then reopening another connection, showing the FD leak:
The text was updated successfully, but these errors were encountered: