lockwiki changes
* 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. * Remove support for unused optional wait parameter from lockwiki.master
parent
eef8b966b3
commit
d1b22b2524
19
IkiWiki.pm
19
IkiWiki.pm
|
@ -1280,8 +1280,7 @@ sub indexlink () { #{{{
|
||||||
|
|
||||||
my $wikilock;
|
my $wikilock;
|
||||||
|
|
||||||
sub lockwiki (;$) { #{{{
|
sub lockwiki () { #{{{
|
||||||
my $wait=@_ ? shift : 1;
|
|
||||||
# Take an exclusive lock on the wiki to prevent multiple concurrent
|
# Take an exclusive lock on the wiki to prevent multiple concurrent
|
||||||
# run issues. The lock will be dropped on program exit.
|
# run issues. The lock will be dropped on program exit.
|
||||||
if (! -d $config{wikistatedir}) {
|
if (! -d $config{wikistatedir}) {
|
||||||
|
@ -1289,20 +1288,8 @@ sub lockwiki (;$) { #{{{
|
||||||
}
|
}
|
||||||
open($wikilock, '>', "$config{wikistatedir}/lockfile") ||
|
open($wikilock, '>', "$config{wikistatedir}/lockfile") ||
|
||||||
error ("cannot write to $config{wikistatedir}/lockfile: $!");
|
error ("cannot write to $config{wikistatedir}/lockfile: $!");
|
||||||
if (! flock($wikilock, 2 | 4)) { # LOCK_EX | LOCK_NB
|
if (! flock($wikilock, 2)) { # LOCK_EX
|
||||||
if ($wait) {
|
error("failed to get lock");
|
||||||
debug("wiki seems to be locked, waiting for lock");
|
|
||||||
my $wait=600; # arbitrary, but don't hang forever to
|
|
||||||
# prevent process pileup
|
|
||||||
for (1..$wait) {
|
|
||||||
return if flock($wikilock, 2 | 4);
|
|
||||||
sleep 1;
|
|
||||||
}
|
|
||||||
error("wiki is locked; waited $wait seconds without lock being freed (possible stuck process or stale lock?)");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
|
@ -14,6 +14,14 @@ 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> Thu, 06 Nov 2008 16:01:00 -0500
|
||||||
|
|
||||||
|
|
|
@ -18,3 +18,5 @@ with no ill effects. Crank `MaxClients` up to 256? No problem..
|
||||||
And there's no real reason to allow more than one ikiwiki cgi to run at a
|
And there's no real reason to allow more than one ikiwiki cgi to run at a
|
||||||
time. Since almost all uses of the CGI lock the index, only one can really
|
time. Since almost all uses of the CGI lock the index, only one can really
|
||||||
be doing anything at a time. --[[Joey]]
|
be doing anything at a time. --[[Joey]]
|
||||||
|
|
||||||
|
[[done]]
|
||||||
|
|
|
@ -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-07 12:23-0500\n"
|
"POT-Creation-Date: 2008-11-11 15:36-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:79
|
#: ../IkiWiki/Wrapper.pm:93
|
||||||
#, 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:135
|
#: ../IkiWiki/Wrapper.pm:150
|
||||||
#, 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:155
|
#: ../IkiWiki/Wrapper.pm:170
|
||||||
#, 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:1685
|
#: ../IkiWiki.pm:1672
|
||||||
msgid "yes"
|
msgid "yes"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue