Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.788
diff -u -p -r1.788 common.inc
--- includes/common.inc	21 Aug 2008 19:36:36 -0000	1.788
+++ includes/common.inc	1 Sep 2008 19:23:46 -0000
@@ -2592,12 +2592,14 @@ function drupal_cron_run() {
  * Shutdown function for cron cleanup.
  */
 function drupal_cron_cleanup() {
-  // See if the semaphore is still locked.
+  // If the cron semaphore is still locked, release it immediately, and
+  // then record a warning. It is important to release the semaphore first,
+  // since PHP may have shut down uncleanly, and the call to watchdog()
+  // could lead to fatal errors. We do not want any such errors to get in
+  // the way of freeing up the semaphore for future cron runs.
   if (variable_get('cron_semaphore', FALSE)) {
-    watchdog('cron', 'Cron run exceeded the time limit and was aborted.', array(), WATCHDOG_WARNING);
-
-    // Release cron semaphore
     variable_del('cron_semaphore');
+    watchdog('cron', 'Cron run failed to complete.', array(), WATCHDOG_WARNING);
   }
 }
 
