make unlockwiki drop the cgilock

This is necessary so that things that fork to the background,
like pinger, and inline ping, don't block other cgis from running.

Note that websetup also calls unlockwiki, before refreshing / rebuilding
the wiki. It makes perfect sense for that not to block other cgis.
master
Joey Hess 2008-11-11 20:48:02 -05:00
parent 521d76e508
commit ecd4f0ee55
4 changed files with 23 additions and 18 deletions

View File

@ -1295,6 +1295,7 @@ sub lockwiki () { #{{{
} #}}} } #}}}
sub unlockwiki () { #{{{ sub unlockwiki () { #{{{
POSIX::close($ENV{IKIWIKI_CGILOCK_FD}) if exists $ENV{IKIWIKI_CGILOCK_FD};
return close($wikilock) if $wikilock; return close($wikilock) if $wikilock;
return; return;
} #}}} } #}}}

View File

@ -72,12 +72,16 @@ EOF
# Avoid more than one ikiwiki cgi running at a time by # Avoid more than one ikiwiki cgi running at a time by
# taking a cgi lock. Since ikiwiki uses several MB of # taking a cgi lock. Since ikiwiki uses several MB of
# memory, a pile up of processes could cause thrashing # memory, a pile up of processes could cause thrashing
# otherwise. # otherwise. The fd of the lock is stored in
# IKIWIKI_CGILOCK_FD so unlockwiki can close it.
$pre_exec=<<"EOF"; $pre_exec=<<"EOF";
{ {
int fd=open("$config{wikistatedir}/cgilock", O_CREAT | O_RDWR, 0666); int fd=open("$config{wikistatedir}/cgilock", O_CREAT | O_RDWR, 0666);
if (fd != -1) if (fd != -1 && flock(fd, LOCK_EX) == 0) {
flock(fd, LOCK_EX); char *fd_s;
asprintf(&fd_s, "%i", fd);
setenv("IKIWIKI_CGILOCK_FD", fd_s, 1);
}
} }
EOF EOF
} }

20
debian/changelog vendored
View File

@ -1,5 +1,13 @@
ikiwiki (2.69) UNRELEASED; urgency=low ikiwiki (2.69) unstable; urgency=low
* Avoid multiple ikiwiki cgi processes piling up, eating all memory,
and thrashing, 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.
* Stop busy-waiting in lockwiki, as this could delay ikiwiki from waking up
for up to one second. The bailout code is no longer needed after above
change.
* Remove support for unused optional wait parameter from lockwiki.
* aggregate: Try to query XML::Feed for the base url when derelevatising * aggregate: Try to query XML::Feed for the base url when derelevatising
links. Since this needs the just released XML::Feed 0.3, as well links. Since this needs the just released XML::Feed 0.3, as well
as a not yet released XML::RSS, it will fall back to the old method as a not yet released XML::RSS, it will fall back to the old method
@ -14,16 +22,8 @@ ikiwiki (2.69) UNRELEASED; urgency=low
* tag: Normalize tagbase so leading/trailing slashes in it don't break * tag: Normalize tagbase so leading/trailing slashes in it don't break
things. things.
* bzr: Fix dates for recentchanges. * bzr: Fix dates for recentchanges.
* Avoid multiple ikiwiki cgi processes piling up, eating all memory,
and thrashing, 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.
* Stop busy-waiting in lockwiki, as this could delay ikiwiki from waking up
for up to one second. The bailout code is no longer needed after above
change.
* Remove support for unused optional wait parameter from lockwiki.
-- Joey Hess <joeyh@debian.org> Thu, 06 Nov 2008 16:01:00 -0500 -- Joey Hess <joeyh@debian.org> Tue, 11 Nov 2008 20:35:55 -0500
ikiwiki (2.68) unstable; urgency=low ikiwiki (2.68) unstable; urgency=low

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-11-11 15:36-0500\n" "POT-Creation-Date: 2008-11-11 20:48-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -910,19 +910,19 @@ msgstr ""
#. translators: The first parameter is a filename, and the second is #. translators: The first parameter is a filename, and the second is
#. translators: a (probably not translated) error message. #. translators: a (probably not translated) error message.
#: ../IkiWiki/Wrapper.pm:93 #: ../IkiWiki/Wrapper.pm:97
#, perl-format #, perl-format
msgid "failed to write %s: %s" msgid "failed to write %s: %s"
msgstr "" msgstr ""
#. translators: The parameter is a C filename. #. translators: The parameter is a C filename.
#: ../IkiWiki/Wrapper.pm:150 #: ../IkiWiki/Wrapper.pm:154
#, perl-format #, perl-format
msgid "failed to compile %s" msgid "failed to compile %s"
msgstr "" msgstr ""
#. translators: The parameter is a filename. #. translators: The parameter is a filename.
#: ../IkiWiki/Wrapper.pm:170 #: ../IkiWiki/Wrapper.pm:174
#, perl-format #, perl-format
msgid "successfully generated %s" msgid "successfully generated %s"
msgstr "" msgstr ""
@ -969,7 +969,7 @@ msgstr ""
msgid "preprocessing loop detected on %s at depth %i" msgid "preprocessing loop detected on %s at depth %i"
msgstr "" msgstr ""
#: ../IkiWiki.pm:1672 #: ../IkiWiki.pm:1673
msgid "yes" msgid "yes"
msgstr "" msgstr ""