SA Bugzilla – Bug 3251
sa-learn doesn't keep the lock file "fresh"
Last modified: 2004-04-08 01:22:26 UTC
from a mail I posted to sa-users: fyi: I looked through the 2.63 code, and it looks like I'm recalling 2.5x learning (lock/unlock per message). In 2.6x we seem to have fixed that issue. It does seem like we open the lock, then do sa-learn without updating the mtime on the lock. Another process, after 600 seconds (10 mins) can break the stale lock, which would cause problems. :( I don't think that code's changed in 3.0, so I'll go open a bugzilla ticket... <grrr>
I have a general fix in my head for this, just need to get it in code. ;)
ok, fix committed to head (r9940) the short version is that we used to lock/unlock per message in 2.5x, and in 2.6x we lock on the first learn() call, keep calling tie_db_writable() per message (just returns since we're already locked), then calls untie() at the end. so instead of just returning in tie_db_writable(), we will first "refresh" the lock via utime() before returning. this will cause more I/O due to the inode updates, but it'll be a lot less than the 2.5x lock per message version. we could kluge it for less I/O by keeping track of when the lock was put in place, then calculating how long it's been since that time, and only refreshing periodically between 0 and LOCK_MAX_AGE seconds. that would require some collusion between BayesStore and Locker though, so I'm not going to worry about this unless I/O becomes an issue. (I think the atime updates I/O << normal Bayes DB I/O ...)