Ticket #1158 (new defect)

Opened 16 months ago

mod_magnet/mod_status: duplicate keys in lighty.status[]

Reported by: moe Owned by: jan
Priority: normal Milestone: 1.5.0
Component: mod_magnet Version: 1.4.15
Severity: major Keywords: mod_magnet mod_status lua
Cc: Blocked By:
Need User Feedback: Blocking:

Description

we're using lighttpd 1.4.15 with mod_magnet, lua 5.1.2 and the following lua script to get a simple hit-counter for monitoring purposes:

-- simple hit counter
local prefix = "(none)"
if ( string.find( reqpath, "/", 2 ) ) then
    prefix = string.match( reqpath, "^([^/]*)", 2 )
end

lighty.status["counter.prefix." .. prefix ] = lighty.status["counter.prefix." .. prefix ] + 1
lighty.status["counter.total" ] = lighty.status["counter.total" ] + 1

the script is referenced like this in our lighty.conf:

magnet.attract-raw-url-to = ( "/path/to/lighty.lua" )

this has worked fine for a while but when i call mod_status right now i get duplicate keys for several popular prefixes, example:

$ curl -s http://127.0.0.1:7979/status | grep base
counter.prefix.base: 8875226
counter.prefix.base: 2206508

only the 2nd value is still incrementing. it seems like the first key was abandoned at some point in time and a new one with the same name created. there have been no restarts or script changes in the meantime and i see no related errors in error.log.

i'd suspect some kind of race condition (the server is dealing ~20 hits/sec) - but interestingly the "total" counter hasn't been duplicated, yet (39510989 still tickin..).

can anyone shed some light on this?

Attachments

Add/Change #1158 (mod_magnet/mod_status: duplicate keys in lighty.status[])

Author



Change Properties
<Author field>
Action
as new
 
Note: See TracTickets for help on using tickets.