make unlockwiki drop the cgilock
authorJoey Hess <joey@kodama.kitenet.net>
Wed, 12 Nov 2008 01:48:02 +0000 (20:48 -0500)
committerJoey Hess <joey@kodama.kitenet.net>
Wed, 12 Nov 2008 01:48:02 +0000 (20:48 -0500)
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.

IkiWiki.pm
IkiWiki/Wrapper.pm
debian/changelog
po/ikiwiki.pot

index d949566d834fb1cfcc053bd48ae91398f2571e80..5e21e7090d09693a0f835d90145df8504142b367 100644 (file)
@@ -1295,6 +1295,7 @@ sub lockwiki () { #{{{
 } #}}}
 
 sub unlockwiki () { #{{{
+       POSIX::close($ENV{IKIWIKI_CGILOCK_FD}) if exists $ENV{IKIWIKI_CGILOCK_FD};
        return close($wikilock) if $wikilock;
        return;
 } #}}}
index 7a2d4381a079aaf5af71a3a4447486a76f5e0c9b..31e30ad2ebb3cd2e8da33996a2e3b8cbcf890da9 100644 (file)
@@ -72,12 +72,16 @@ EOF
                # 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.
+               # otherwise. The fd of the lock is stored in
+               # IKIWIKI_CGILOCK_FD so unlockwiki can close it.
                $pre_exec=<<"EOF";
        {
                int fd=open("$config{wikistatedir}/cgilock", O_CREAT | O_RDWR, 0666);
-               if (fd != -1)
-                       flock(fd, LOCK_EX);
+               if (fd != -1 && flock(fd, LOCK_EX) == 0) {
+                       char *fd_s;
+                       asprintf(&fd_s, "%i", fd);
+                       setenv("IKIWIKI_CGILOCK_FD", fd_s, 1);
+               }
        }
 EOF
        }
index 2088b07ecf5425dce84203ea857ec9f90c39af32..99f35482e942e6d75269f89eb00a08aa139f83c2 100644 (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
     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
@@ -14,16 +22,8 @@ ikiwiki (2.69) UNRELEASED; urgency=low
   * tag: Normalize tagbase so leading/trailing slashes in it don't break
     things.
   * 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
 
index 8cf3853e0b199df2c41b4cad0033eaae6a94e0a7..feb36c742105b3f953db2e918ae389038f12258e 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\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"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\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: a (probably not translated) error message.
-#: ../IkiWiki/Wrapper.pm:93
+#: ../IkiWiki/Wrapper.pm:97
 #, perl-format
 msgid "failed to write %s: %s"
 msgstr ""
 
 #. translators: The parameter is a C filename.
-#: ../IkiWiki/Wrapper.pm:150
+#: ../IkiWiki/Wrapper.pm:154
 #, perl-format
 msgid "failed to compile %s"
 msgstr ""
 
 #. translators: The parameter is a filename.
-#: ../IkiWiki/Wrapper.pm:170
+#: ../IkiWiki/Wrapper.pm:174
 #, perl-format
 msgid "successfully generated %s"
 msgstr ""
@@ -969,7 +969,7 @@ msgstr ""
 msgid "preprocessing loop detected on %s at depth %i"
 msgstr ""
 
-#: ../IkiWiki.pm:1672
+#: ../IkiWiki.pm:1673
 msgid "yes"
 msgstr ""