summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Dumpleton <Graham.Dumpleton@gmail.com>2015-06-01 16:42:11 +1000
committerGraham Dumpleton <Graham.Dumpleton@gmail.com>2015-06-01 16:42:11 +1000
commit18aaab93f97dde134520657395de1eeef1b36f5b (patch)
tree82946dc47c464093bdc509eb88fb082734dd8ef3
parented155b3e67cf563a1def4c85f2757060ed7cb600 (diff)
parentfae1d1bf934404309759837755fa2eb28429f718 (diff)
downloadmod_wsgi-18aaab93f97dde134520657395de1eeef1b36f5b.tar.gz
Merge branch 'release/4.4.12'4.4.12
-rw-r--r--docs/release-notes/index.rst1
-rw-r--r--docs/release-notes/version-4.4.12.rst22
-rw-r--r--src/server/__init__.py2
-rw-r--r--src/server/mod_wsgi.c24
-rw-r--r--src/server/wsgi_version.h4
5 files changed, 46 insertions, 7 deletions
diff --git a/docs/release-notes/index.rst b/docs/release-notes/index.rst
index f57fa2a..530e192 100644
--- a/docs/release-notes/index.rst
+++ b/docs/release-notes/index.rst
@@ -5,6 +5,7 @@ Release Notes
.. toctree::
:maxdepth: 2
+ version-4.4.12.rst
version-4.4.11.rst
version-4.4.10.rst
version-4.4.9.rst
diff --git a/docs/release-notes/version-4.4.12.rst b/docs/release-notes/version-4.4.12.rst
new file mode 100644
index 0000000..027a454
--- /dev/null
+++ b/docs/release-notes/version-4.4.12.rst
@@ -0,0 +1,22 @@
+==============
+Version 4.4.12
+==============
+
+Version 4.4.12 of mod_wsgi can be obtained from:
+
+ https://codeload.github.com/GrahamDumpleton/mod_wsgi/tar.gz/4.4.12
+
+For details on the availability of Windows binaries see:
+
+ https://github.com/GrahamDumpleton/mod_wsgi/tree/master/win32
+
+Bugs Fixed
+----------
+
+1. If the WSGI application when run under daemon mode returned response
+content as many small blocks, this could result in excessive memory
+usage in the Apache child worker process proxying the request due to
+many buckets being buffered until the buffer size threshold was reached.
+If the number of buckets reaches a builtin threshold the buffered data
+will now be forcibly flushed even if the size threshold hadn't been
+reached.
diff --git a/src/server/__init__.py b/src/server/__init__.py
index 2bf5d4f..8a5c10f 100644
--- a/src/server/__init__.py
+++ b/src/server/__init__.py
@@ -1736,7 +1736,7 @@ option_list = (
'over the secure connection.'),
optparse.make_option('--hsts-policy', default=None, metavar='PARAMS',
- help='Specify the HTST policy that should be applied when '
+ help='Specify the HSTS policy that should be applied when '
'HTTPS only connections are being enforced.'),
optparse.make_option('--server-name', default=None, metavar='HOSTNAME',
diff --git a/src/server/mod_wsgi.c b/src/server/mod_wsgi.c
index 09dc527..03990a4 100644
--- a/src/server/mod_wsgi.c
+++ b/src/server/mod_wsgi.c
@@ -10590,6 +10590,8 @@ static int wsgi_transfer_response(request_rec *r, apr_bucket_brigade *bb,
apr_size_t bytes_transfered = 0;
+ int bucket_count = 0;
+
if (buffer_size == 0)
buffer_size = 65536;
@@ -10676,6 +10678,8 @@ static int wsgi_transfer_response(request_rec *r, apr_bucket_brigade *bb,
bytes_transfered = 0;
+ bucket_count = 0;
+
/*
* Retry read from daemon using a blocking read. We do
* not delete the bucket as we want to operate on the
@@ -10713,19 +10717,31 @@ static int wsgi_transfer_response(request_rec *r, apr_bucket_brigade *bb,
APR_BRIGADE_INSERT_TAIL(tmpbb, e);
/*
- * If we have reached the threshold, we want to flush the
- * data so that we aren't buffering too much in memory
- * and blowing out memory size.
+ * If we have reached the buffer size threshold, we want
+ * to flush the data so that we aren't buffering too much
+ * in memory and blowing out memory size. We also have a
+ * check on the number of buckets we have accumulated as
+ * a large number of buckets with very small amounts of
+ * data will also accumulate a lot of memory. Apache's
+ * own flow control doesn't cope with such a situation.
+ * Right now hard wire the max number of buckets at 16
+ * which equates to worst case number of separate data
+ * blocks can be written by a writev() call on systems
+ * such as Solaris.
*/
bytes_transfered += length;
- if (bytes_transfered > buffer_size) {
+ bucket_count += 1;
+
+ if (bytes_transfered > buffer_size || bucket_count >= 16) {
APR_BRIGADE_INSERT_TAIL(tmpbb, apr_bucket_flush_create(
r->connection->bucket_alloc));
bytes_transfered = 0;
+ bucket_count = 0;
+
/*
* Since we flushed the data out to the client, it is
* okay to go back and do a blocking read the next time.
diff --git a/src/server/wsgi_version.h b/src/server/wsgi_version.h
index ea29f10..ad2d958 100644
--- a/src/server/wsgi_version.h
+++ b/src/server/wsgi_version.h
@@ -25,8 +25,8 @@
#define MOD_WSGI_MAJORVERSION_NUMBER 4
#define MOD_WSGI_MINORVERSION_NUMBER 4
-#define MOD_WSGI_MICROVERSION_NUMBER 11
-#define MOD_WSGI_VERSION_STRING "4.4.11"
+#define MOD_WSGI_MICROVERSION_NUMBER 12
+#define MOD_WSGI_VERSION_STRING "4.4.12"
/* ------------------------------------------------------------------------- */