bdurand/lumberjack — Issue #6: Processes waiting indefinitely for exclusive locks while rotating
Author: sriedel
Created: 2012-03-02 10:41:34+00:00
State: open

I'm currently using lumberjack as a resque logger with daily log rotation. When the log file needs to be rotated, the workers tend to hang indefinitely. Checking the process with strace reveals the worker is waiting for an exclusive lock on the logfile.

My current suspicion is that in lib/lumberjack/device/rolling_log_file.rb:106 stream.flock( LOCK::UN ) should be file.flock( LOCK_UN ) ?

As a workaround I'll add LOCK_NB to the LOCK_EX and return early if the lock could not be achieved for the time being.