• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Are the stale .lease files removed?

Cairo's mailnotify removed stale .lock files. The MailerContrib's mail script removed that functionality but provided a remove_obsolete_locks script. That script is no longer in the contrib. What happens to stale .lease files?

-- PTh

We don't do anything with them. They are extremely small, only referenced when a topic is edited, refreshed when an edit starts and removed when an edit closes cleanly, so I couldn't see the point wasting effort on them.

If you want to add a removal process, then there is already a cron script that removes session files. You could add the functionality there. Though IMHO it's a waste of time.


No, not a waste of time: Performance. Consider a web with 40,000 topics. If you do not remove the obsolete .lease files you will have eventually 120,000 files instead of 80,000.

This is not an "Enhancement" because Cairo and earlier versions removed the stale .lock files. This is removed functionality. Reclassified as "Normal" (but is actually an "Urgent" for organizations with large webs).

I am fine with a "document only" solution that has an example on how to remove stale files only, not all. If documentation solution, the doc needs to be written for inexperienced system administrators.

-- PTh

Just to clarify again; lease files are only left around when a user navigates away from an edit page without saving or cancelling their edit. To generate 40,000 lease files in a web would involve opening all 40,000 topics for edit, and then navigating away from each without saving. Possible, I suppose, but rather unlikely.

Here's a rewritten expire_sessions.pl cron script (designed to be run from 'tools', and untested):

# This is so it can pick up the right TWiki environment from
# setlib.cfg.
    unshift @INC, '.';
    require 'setlib.cfg';

# It will expire sessions that have not been used for
# |{Sessions}{ExpireAfter}| seconds i.e. if you set {Sessions}{ExpireAfter}
# to -36000 or 36000 it will expire sessions that have not been used for
# more than 100 hours.

use TWiki::Client;


# It will also remove topic leases that have expired.

use TWiki;

my $twiki = new TWiki();
my $store = $twiki->{store};
foreach my $web ( $store->getListOfWebs()) {
    foreach my $topic ( $store->getTopicNames( $web )) {
       my $lease = $store->getLease( $web, $topic );
       if( $lease && $lease->{expires} < time()) {
          $store->clearLease( $web, $topic );

It just needs someone to test it and check it in.


SVN 8187


Summary (Add cron script to) Remove obsolete .lease files SOMEONE HELP PLEASE
ReportedBy PeterThoeny

SVN Range Tue, 03 Jan 2006 build 8080
AppliesTo Engine

Priority Normal
CurrentState Closed

Checkins 8184 8185 8187
Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r7 - 2006-01-09 - CrawfordCurrie
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback