Skip to content

Commit 18aaab9

Browse files
Merge branch 'release/4.4.12'
2 parents ed155b3 + fae1d1b commit 18aaab9

File tree

5 files changed

+46
-7
lines changed

5 files changed

+46
-7
lines changed

docs/release-notes/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Release Notes
55
.. toctree::
66
:maxdepth: 2
77

8+
version-4.4.12.rst
89
version-4.4.11.rst
910
version-4.4.10.rst
1011
version-4.4.9.rst

docs/release-notes/version-4.4.12.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
==============
2+
Version 4.4.12
3+
==============
4+
5+
Version 4.4.12 of mod_wsgi can be obtained from:
6+
7+
https://codeload.github.com/GrahamDumpleton/mod_wsgi/tar.gz/4.4.12
8+
9+
For details on the availability of Windows binaries see:
10+
11+
https://github.com/GrahamDumpleton/mod_wsgi/tree/master/win32
12+
13+
Bugs Fixed
14+
----------
15+
16+
1. If the WSGI application when run under daemon mode returned response
17+
content as many small blocks, this could result in excessive memory
18+
usage in the Apache child worker process proxying the request due to
19+
many buckets being buffered until the buffer size threshold was reached.
20+
If the number of buckets reaches a builtin threshold the buffered data
21+
will now be forcibly flushed even if the size threshold hadn't been
22+
reached.

src/server/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1736,7 +1736,7 @@ def check_percentage(option, opt_str, value, parser):
17361736
'over the secure connection.'),
17371737

17381738
optparse.make_option('--hsts-policy', default=None, metavar='PARAMS',
1739-
help='Specify the HTST policy that should be applied when '
1739+
help='Specify the HSTS policy that should be applied when '
17401740
'HTTPS only connections are being enforced.'),
17411741

17421742
optparse.make_option('--server-name', default=None, metavar='HOSTNAME',

src/server/mod_wsgi.c

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10590,6 +10590,8 @@ static int wsgi_transfer_response(request_rec *r, apr_bucket_brigade *bb,
1059010590

1059110591
apr_size_t bytes_transfered = 0;
1059210592

10593+
int bucket_count = 0;
10594+
1059310595
if (buffer_size == 0)
1059410596
buffer_size = 65536;
1059510597

@@ -10676,6 +10678,8 @@ static int wsgi_transfer_response(request_rec *r, apr_bucket_brigade *bb,
1067610678

1067710679
bytes_transfered = 0;
1067810680

10681+
bucket_count = 0;
10682+
1067910683
/*
1068010684
* Retry read from daemon using a blocking read. We do
1068110685
* 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,
1071310717
APR_BRIGADE_INSERT_TAIL(tmpbb, e);
1071410718

1071510719
/*
10716-
* If we have reached the threshold, we want to flush the
10717-
* data so that we aren't buffering too much in memory
10718-
* and blowing out memory size.
10720+
* If we have reached the buffer size threshold, we want
10721+
* to flush the data so that we aren't buffering too much
10722+
* in memory and blowing out memory size. We also have a
10723+
* check on the number of buckets we have accumulated as
10724+
* a large number of buckets with very small amounts of
10725+
* data will also accumulate a lot of memory. Apache's
10726+
* own flow control doesn't cope with such a situation.
10727+
* Right now hard wire the max number of buckets at 16
10728+
* which equates to worst case number of separate data
10729+
* blocks can be written by a writev() call on systems
10730+
* such as Solaris.
1071910731
*/
1072010732

1072110733
bytes_transfered += length;
1072210734

10723-
if (bytes_transfered > buffer_size) {
10735+
bucket_count += 1;
10736+
10737+
if (bytes_transfered > buffer_size || bucket_count >= 16) {
1072410738
APR_BRIGADE_INSERT_TAIL(tmpbb, apr_bucket_flush_create(
1072510739
r->connection->bucket_alloc));
1072610740

1072710741
bytes_transfered = 0;
1072810742

10743+
bucket_count = 0;
10744+
1072910745
/*
1073010746
* Since we flushed the data out to the client, it is
1073110747
* okay to go back and do a blocking read the next time.

src/server/wsgi_version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525

2626
#define MOD_WSGI_MAJORVERSION_NUMBER 4
2727
#define MOD_WSGI_MINORVERSION_NUMBER 4
28-
#define MOD_WSGI_MICROVERSION_NUMBER 11
29-
#define MOD_WSGI_VERSION_STRING "4.4.11"
28+
#define MOD_WSGI_MICROVERSION_NUMBER 12
29+
#define MOD_WSGI_VERSION_STRING "4.4.12"
3030

3131
/* ------------------------------------------------------------------------- */
3232

0 commit comments

Comments
 (0)