You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rp...@apache.org on 2007/12/29 17:28:58 UTC

svn commit: r607443 - in /httpd/httpd/branches/2.2.x: CHANGES STATUS modules/cache/mod_disk_cache.c

Author: rpluem
Date: Sat Dec 29 08:28:57 2007
New Revision: 607443

URL: http://svn.apache.org/viewvc?rev=607443&view=rev
Log:
Merge r409942, r607245, r607440 from trunk:

* Remove temporary files if renaming fails, otherwise they may accumulate.


* Make loglevel consistent for similar situations. As this really should not
  happen set it to error.


* Change loglevel from ERROR to WARNING if the renaming of the vary, headers
  or data file fails.

Submitted by: Davi Arnaut <davi haxent.com.br>
Reviewed by: rpluem, niq, wrowe

Modified:
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/modules/cache/mod_disk_cache.c

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?rev=607443&r1=607442&r2=607443&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Sat Dec 29 08:28:57 2007
@@ -10,6 +10,9 @@
      mod_imagemap: Fix a cross-site scripting issue.  Reported by JPCERT.
      [Joe Orton]
 
+  *) mod_disk_cache: Delete temporary files if they cannot be renamed to their
+     final name. [Davi Arnaut <davi haxent.com.br>]
+
   *) http_protocol: Escape request method in 405 error reporting.
      This has no security impact since the browser cannot be tricked
      into sending arbitrary method strings.  [Jeff Trawick]

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=607443&r1=607442&r2=607443&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Sat Dec 29 08:28:57 2007
@@ -122,25 +122,6 @@
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-   * mod_disk_cache: Delete temporary files if they cannot be renamed to their
-     final name.
-      Trunk version of patch:
-         http://svn.apache.org/viewcvs.cgi?rev=409942&view=rev
-         http://svn.apache.org/viewcvs.cgi?rev=607245&view=rev
-         http://svn.apache.org/viewcvs.cgi?rev=607440&view=rev
-      Backport version for 2.2.x of patch:
-         Trunk version of patch works
-      +1: rpluem, niq, wrowe
-      niq: Provisional +1, but the error logging should be at a consistent
-           level (maybe WARNING?)
-      rpluem: Set it to ERROR in all cases as IMHO this should not happen.
-              If this level is too high we can reduce it later.
-      wrowe: disagree with rpluem - it's incredibly disruptive to admins
-             to have their logs filled with noise - warning would be ok, 
-             provided there's no more than one entry per failed request.
-             If their request would die outright, only then is rpluem right.
-      rpluem: Level now set to WARNING.
-
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
 

Modified: httpd/httpd/branches/2.2.x/modules/cache/mod_disk_cache.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/cache/mod_disk_cache.c?rev=607443&r1=607442&r2=607443&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/cache/mod_disk_cache.c (original)
+++ httpd/httpd/branches/2.2.x/modules/cache/mod_disk_cache.c Sat Dec 29 08:28:57 2007
@@ -165,7 +165,10 @@
          */
         rv = apr_file_rename(dobj->tempfile, dobj->datafile, r->pool);
         if (rv != APR_SUCCESS) {
-            /* XXX log */
+            ap_log_error(APLOG_MARK, APLOG_WARNING, rv, r->server,
+                         "disk_cache: rename tempfile to datafile failed:"
+                         " %s -> %s", dobj->tempfile, dobj->datafile);
+            apr_file_remove(dobj->tempfile, r->pool);
         }
 
         dobj->tfd = NULL;
@@ -856,9 +859,10 @@
             rv = safe_file_rename(conf, dobj->tempfile, dobj->hdrsfile,
                                   r->pool);
             if (rv != APR_SUCCESS) {
-                ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, r->server,
+                ap_log_error(APLOG_MARK, APLOG_WARNING, rv, r->server,
                     "disk_cache: rename tempfile to varyfile failed: %s -> %s",
                     dobj->tempfile, dobj->hdrsfile);
+                apr_file_remove(dobj->tempfile, r->pool);
                 return rv;
             }
 
@@ -946,9 +950,10 @@
 
     rv = safe_file_rename(conf, dobj->tempfile, dobj->hdrsfile, r->pool);
     if (rv != APR_SUCCESS) {
-        ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
+        ap_log_error(APLOG_MARK, APLOG_WARNING, rv, r->server,
                      "disk_cache: rename tempfile to hdrsfile failed: %s -> %s",
                      dobj->tempfile, dobj->hdrsfile);
+        apr_file_remove(dobj->tempfile, r->pool);
         return rv;
     }