]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r1897182, r1897614, r1897615, r1897619 from trunk:
authorRuediger Pluem <rpluem@apache.org>
Wed, 9 Feb 2022 12:29:13 +0000 (12:29 +0000)
committerRuediger Pluem <rpluem@apache.org>
Wed, 9 Feb 2022 12:29:13 +0000 (12:29 +0000)
* Allocate the dav_liveprop_elem structure only once in the lifetime of the
  resource->pool and reuse it to avoid unnecessary huge memory allocations
  during collection walks.

* CHANGES entry for r1897182

* Fix typo

* Stupid mine. Evgeny is a committer here

Reviewed by: rpluem, jorton, ylavic

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1897901 13f79535-47bb-0310-9956-ffa450edef68

STATUS
changes-entries/mod_dav_memory_regresssion.txt [new file with mode: 0644]
modules/dav/main/props.c

diff --git a/STATUS b/STATUS
index 26d4c8e3b0e05750a94305abaea064b445514986..670b6155b957c4e32ef5b7aeaa3c96119662ac42 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -179,18 +179,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
              Proposed for backport below, in place of or after this one.
      rpluem: +1 on PR 289 as well.
 
-  *) mod_dav: Fix regression when gathering properties which could lead to huge
-     memory consumption proportional to the number of resources.
-     Trunk version of patch:
-        https://svn.apache.org/r1897182
-        https://svn.apache.org/r1897614
-        https://svn.apache.org/r1897615
-        https://svn.apache.org/r1897619
-     Backport version for 2.4.x of patch:
-      Trunk version of patch works
-      svn merge -c 1897182,1897614,1897615,1897619 ^/httpd/httpd/trunk .
-     +1: rpluem, jorton, ylavic
-
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
diff --git a/changes-entries/mod_dav_memory_regresssion.txt b/changes-entries/mod_dav_memory_regresssion.txt
new file mode 100644 (file)
index 0000000..65b50c5
--- /dev/null
@@ -0,0 +1,3 @@
+  *) mod_dav: Fix regression when gathering properties which could lead to huge
+     memory consumption proportional to the number of resources.
+     [Evgeny Kotkov, Ruediger Pluem]
index a117bc0395edc94f4216d17b7d235c34ba5189a9..9ad6d6db5841d6152f4a1305e0f51085d8381c93 100644 (file)
@@ -728,9 +728,15 @@ DAV_DECLARE(dav_get_props_result) dav_get_props(dav_propdb *propdb,
     /* we lose both the document and the element when calling (insert_prop),
      * make these available in the pool.
      */
-    element = apr_pcalloc(propdb->resource->pool, sizeof(dav_liveprop_elem));
+    element = dav_get_liveprop_element(propdb->resource);
+    if (!element) {
+        element = apr_pcalloc(propdb->resource->pool, sizeof(dav_liveprop_elem));
+        apr_pool_userdata_setn(element, DAV_PROP_ELEMENT, NULL, propdb->resource->pool);
+    }
+    else {
+        memset(element, 0, sizeof(dav_liveprop_elem));
+    }
     element->doc = doc;
-    apr_pool_userdata_setn(element, DAV_PROP_ELEMENT, NULL, propdb->resource->pool);
 
     /* ### NOTE: we should pass in TWO buffers -- one for keys, one for
        the marks */