Log spam on shared dictionary eviction #163

Closed
jimpurbrick opened this Issue Oct 11, 2012 · 2 comments

Projects

None yet

3 participants

@jimpurbrick

I'm using several lua_shared_dicts which work fine as LRU caches, but seem to log "ngx_slab_alloc() failed: no memory in lua_shared_dict" errors to the nginx error.log on eviction. It would be nice if the shared dictionaries didn't cause errors when operating normally as those errors may mask real problems that need investigating.

This problem was seen using simpl-ngx_devel_kit-v0.2.17-0-gbc97eea and chaoslawful-lua-nginx-module-v0.5.0rc28-0-g7a7ac79.

Thanks,

Jim

@bakins
OpenResty member

The error is generated in nginx core, so ngx_lua cannot stop it from logging. If you have expire times set then you can do something like this:

local cats = ngx.shared.cats
local succ, err, forcible = cats:set("Marry", "it is a nice cat!")
if forcible then
    cats:flush_expired()
end    

And it will flush the expired entries. This use case was the reason I suggested flush_expired.

@agentzh
OpenResty member

I'd copy what Brian Akins has said. Consider it resolved.

@agentzh agentzh closed this Oct 15, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment