summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2018-09-04 01:49:46 +0200
committerYann Ylavic <ylavic@apache.org>2018-09-04 01:49:46 +0200
commit0a61dd979a60a09c80234e6dea3ad69e357d43d1 (patch)
treefd649ce591ad54314af6cdeb4a897db0a07a82c5 /include
parentOn the trunk: (diff)
downloadapache2-0a61dd979a60a09c80234e6dea3ad69e357d43d1.tar.xz
apache2-0a61dd979a60a09c80234e6dea3ad69e357d43d1.zip
core: always allocate filters (ap_filter_t) on f->c->pool.
When filters are allocated on f->r->pool, they may be destroyed any time underneath themselves which makes it hard for them to be passed the EOR and forward it (*f can't be dereferenced anymore when the EOR is destroyed, thus before request filters return). On the util_filter side, it also makes it impossible to flush pending request filters when they have set aside the EOR, since f->bb can't be accessed after it's passed to the f->next. So we always use f->c->pool to allocate filters and pending brigades, and to avoid leaks with keepalive requests (long living connections handling multiple requests), filters and brigades are recycled with a cleanup on f->r->pool. Recycling is done (generically) with a spare data ring (void pointers), and a filter(s) context struct is associated with the conn_rec to maintain the rings by connection, that is: struct ap_filter_conn_ctx { struct ap_filter_ring *pending_input_filters; struct ap_filter_ring *pending_output_filters; struct ap_filter_spare_ring *spare_containers, *spare_brigades, *spare_filters, *spare_flushes; int flushing; }; MMN major bumped (again). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1839997 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include')
-rw-r--r--include/ap_mmn.h6
-rw-r--r--include/httpd.h8
-rw-r--r--include/util_filter.h9
3 files changed, 10 insertions, 13 deletions
diff --git a/include/ap_mmn.h b/include/ap_mmn.h
index bfd36d5fa5..be63709a52 100644
--- a/include/ap_mmn.h
+++ b/include/ap_mmn.h
@@ -598,13 +598,15 @@
* 20180720.7 (2.5.1-dev) worker_share struct re-organized
* 20180902.1 (2.5.1-dev) Split conn_rec pending_filters in two rings,
* pending_input_filters and pending_output_filters
- *
+ * 20180903.1 (2.5.1-dev) Replace conn_rec pending_{in,out}put_filters by
+ * filter_conn_ctx, remove argument pool from
+ * ap_filter_prepare_brigade()
*/
#define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
#ifndef MODULE_MAGIC_NUMBER_MAJOR
-#define MODULE_MAGIC_NUMBER_MAJOR 20180902
+#define MODULE_MAGIC_NUMBER_MAJOR 20180903
#endif
#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */
diff --git a/include/httpd.h b/include/httpd.h
index 808e3d4caf..977c042897 100644
--- a/include/httpd.h
+++ b/include/httpd.h
@@ -1111,7 +1111,7 @@ typedef enum {
AP_CONN_KEEPALIVE
} ap_conn_keepalive_e;
-/* For struct ap_filter and ap_filter_ring */
+/* For struct ap_filter_conn_ctx */
#include "util_filter.h"
/**
@@ -1224,10 +1224,8 @@ struct conn_rec {
/** Array of requests being handled under this connection. */
apr_array_header_t *requests;
- /** Ring of pending input filters (with setaside buckets) */
- struct ap_filter_ring *pending_input_filters;
- /** Ring of pending output filters (with setaside buckets) */
- struct ap_filter_ring *pending_output_filters;
+ /** Filters' context for this connection */
+ struct ap_filter_conn_ctx *filter_conn_ctx;
/** The minimum level of filter type to allow setaside buckets */
int async_filter;
diff --git a/include/util_filter.h b/include/util_filter.h
index e863bfe7a1..0417d3015c 100644
--- a/include/util_filter.h
+++ b/include/util_filter.h
@@ -304,9 +304,9 @@ struct ap_filter_t {
};
/**
- * @brief The type of a filters' ring (opaque).
+ * @brief The filters' context in conn_rec (opaque).
*/
-typedef struct ap_filter_ring ap_filter_ring_t;
+struct ap_filter_conn_ctx;
/**
* Get the current bucket brigade from the next filter on the filter
@@ -569,12 +569,9 @@ AP_DECLARE(apr_status_t) ap_save_brigade(ap_filter_t *f,
* filters, or can be used within an output filter by being called via
* ap_filter_setaside_brigade().
* @param f The current filter
- * @param p The pool that was used to create the brigade. In a request
- * filter this will be the request pool, in a connection filter this will
- * be the connection pool.
* @returns OK if a brigade was created, DECLINED otherwise.
*/
-AP_DECLARE(int) ap_filter_prepare_brigade(ap_filter_t *f, apr_pool_t **p);
+AP_DECLARE(int) ap_filter_prepare_brigade(ap_filter_t *f);
/**
* Prepare a bucket brigade to be setaside, creating a dedicated pool if