From 6611f3a2d9eda262a07bb506b204e8bbf0728c38 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 11 Nov 2008 13:44:39 -0500 Subject: bzr: Fix dates for recentchanges. --- IkiWiki/Plugin/bzr.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'IkiWiki') diff --git a/IkiWiki/Plugin/bzr.pm b/IkiWiki/Plugin/bzr.pm index 101e91b93..1054f5b3e 100644 --- a/IkiWiki/Plugin/bzr.pm +++ b/IkiWiki/Plugin/bzr.pm @@ -246,7 +246,7 @@ sub rcs_recentchanges ($) { #{{{ rev => $info->{"revno"}, user => $user, committype => "bzr", - when => time - str2time($info->{"timestamp"}), + when => str2time($info->{"timestamp"}), message => [@message], pages => [@pages], }; -- cgit v1.2.3 From 9a48669f1e9d83422781f6f175c3be8bce80cd26 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 11 Nov 2008 15:40:04 -0500 Subject: avoid multiple ikiwiki cgi processes piling up, eating all memory, and thrashing Fixed by making the cgi wrapper wait on a cgilock. If you had to set apache's MaxClients low to avoid ikiwiki thrashing your server, you can now turn it up to a high value. The downside to this is that a cgi call that doesn't need to call lockwiki will be serialised by this so only one can run at a time. (For example, do=search.) There are few such calls, and all of them call loadindex, so each still eats gobs of memory, so serialising them still seems ok. --- IkiWiki/Wrapper.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'IkiWiki') diff --git a/IkiWiki/Wrapper.pm b/IkiWiki/Wrapper.pm index 99237d3b5..d7d7f65b8 100644 --- a/IkiWiki/Wrapper.pm +++ b/IkiWiki/Wrapper.pm @@ -44,6 +44,7 @@ EOF } my $check_commit_hook=""; + my $pre_exec=""; if ($config{post_commit}) { # Optimise checking !commit_hook_enabled() , # so that ikiwiki does not have to be started if the @@ -67,6 +68,19 @@ EOF } EOF } + elsif ($config{cgi}) { + # Avoid more than one ikiwiki cgi running at a time by + # taking a cgi lock. Since ikiwiki uses several MB of + # memory, a pile up of processes could cause thrashing + # otherwise. + $pre_exec=<<"EOF"; + { + int fd=open("$config{wikistatedir}/cgilock", O_CREAT | O_RDWR); + if (fd != -1) + flock(fd, LOCK_EX); + } +EOF + } $Data::Dumper::Indent=0; # no newlines my $configstring=Data::Dumper->Dump([\%config], ['*config']); @@ -122,6 +136,7 @@ $envsave exit(1); } +$pre_exec execl("$this", "$this", NULL); perror("exec $this"); exit(1); -- cgit v1.2.3 From eef8b966b366a11b69248d16f4f283d0dfbe3023 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 11 Nov 2008 15:53:55 -0500 Subject: O_CREATE needs mode --- IkiWiki/Wrapper.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'IkiWiki') diff --git a/IkiWiki/Wrapper.pm b/IkiWiki/Wrapper.pm index d7d7f65b8..7a2d4381a 100644 --- a/IkiWiki/Wrapper.pm +++ b/IkiWiki/Wrapper.pm @@ -59,7 +59,7 @@ EOF # the benefit of this optimisation. $check_commit_hook=<<"EOF"; { - int fd=open("$config{wikistatedir}/commitlock", O_CREAT | O_RDWR); + int fd=open("$config{wikistatedir}/commitlock", O_CREAT | O_RDWR, 0666); if (fd != -1) { if (flock(fd, LOCK_SH | LOCK_NB) != 0) exit(0); @@ -75,7 +75,7 @@ EOF # otherwise. $pre_exec=<<"EOF"; { - int fd=open("$config{wikistatedir}/cgilock", O_CREAT | O_RDWR); + int fd=open("$config{wikistatedir}/cgilock", O_CREAT | O_RDWR, 0666); if (fd != -1) flock(fd, LOCK_EX); } -- cgit v1.2.3