|
| 1 | +============= |
| 2 | +Version 6.0.2 |
| 3 | +============= |
| 4 | + |
| 5 | +Features Changed |
| 6 | +---------------- |
| 7 | + |
| 8 | +* The way mod_wsgi proxies a response body back from a daemon process to |
| 9 | + the HTTP client has been reworked so that it no longer interferes with |
| 10 | + downstream output filters that pace or batch data, most notably |
| 11 | + ``mod_ratelimit``. Previously mod_wsgi forced a flush both every time the |
| 12 | + daemon socket momentarily ran dry and after each ``response-buffer-size`` |
| 13 | + worth of data had been passed on. Both kinds of flush forced the |
| 14 | + ``mod_ratelimit`` ``RATE_LIMIT`` filter to emit a short write and so |
| 15 | + throttled daemon mode responses far below the configured rate. As |
| 16 | + mod_wsgi requires Apache 2.4, whose core output filter already bounds how |
| 17 | + much response data is buffered in the Apache child processes, these |
| 18 | + forced flushes are no longer needed to limit memory use and have been |
| 19 | + removed. mod_wsgi now passes response data straight on, so a pacing |
| 20 | + filter receives full-size writes and works correctly, while a genuinely |
| 21 | + idle application still has its partial output flushed promptly so |
| 22 | + streaming responses remain responsive. |
| 23 | + |
| 24 | + The visible effect of the previous behaviour varied with the version of |
| 25 | + Apache in use. With some versions of mod_ratelimit the forced flushes |
| 26 | + effectively let the response through at close to full speed, so a |
| 27 | + configured rate limit had little effect; with others they caused the |
| 28 | + rate limit to be applied far too aggressively, throttling the response |
| 29 | + well below the configured rate. In neither case could the rate limit be |
| 30 | + honoured accurately for a daemon mode response, which it now is. |
| 31 | + |
| 32 | + Two options on the :doc:`../configuration-directives/WSGIDaemonProcess` |
| 33 | + directive control this behaviour: |
| 34 | + |
| 35 | + - The new ``response-flush-delay`` option (default 5 milliseconds) sets |
| 36 | + how long mod_wsgi waits for more response data before flushing when the |
| 37 | + daemon socket runs dry, so a transient stall during an active transfer |
| 38 | + does not trigger a flush while a genuinely paused application still has |
| 39 | + its output flushed within that delay. Setting it to 0 flushes on any |
| 40 | + stall and is not recommended when a pacing filter such as |
| 41 | + ``mod_ratelimit`` is in use, as it can throttle responses far below the |
| 42 | + configured rate. |
| 43 | + |
| 44 | + - The ``response-buffer-size`` option has changed meaning. It is now a |
| 45 | + coarse runaway guard that forces a flush only once this many bytes have |
| 46 | + been passed downstream without one, in order to bound a downstream |
| 47 | + filter that buffers without draining. Its default has been raised from |
| 48 | + 65536 bytes to 8388608 bytes (8 MB) accordingly; normal bounding of |
| 49 | + response memory use is handled by the Apache core output filter. |
| 50 | + |
| 51 | +Bugs Fixed |
| 52 | +---------- |
| 53 | + |
| 54 | +* Building the Windows ``mod_wsgi`` extension failed at the link stage with |
| 55 | + a ``LNK2005`` multiply defined symbol error for ``PyInit_mod_wsgi``, and a |
| 56 | + fatal ``LNK1169``. When the single ``mod_wsgi.c`` source file was split |
| 57 | + into the separate ``wsgi_*.c`` files in version 6.0.0, the real |
| 58 | + ``PyInit_mod_wsgi`` module init function moved into ``wsgi_module.c`` as |
| 59 | + an unconditional definition, but an older Windows-only stub of the same |
| 60 | + function was left behind in ``mod_wsgi.c``. On non-Windows builds the stub |
| 61 | + was excluded by ``#if defined(_WIN32)`` so only one definition was |
| 62 | + compiled, but on Windows both were compiled and the linker rejected the |
| 63 | + duplicate. The obsolete stub has been removed so ``wsgi_module.c`` is the |
| 64 | + sole provider of ``PyInit_mod_wsgi`` on all platforms. |
| 65 | + |
| 66 | +* Setting ``WSGIRestrictEmbedded Off`` after it had previously been set |
| 67 | + to ``On`` could crash the Apache child process when an embedded mode |
| 68 | + request was subsequently received. ``WSGIRestrictEmbedded On`` not only |
| 69 | + blocks embedded mode requests but, as an optimisation, also suppresses |
| 70 | + initialisation of Python in the Apache child processes when nothing |
| 71 | + else requires it. Switching it back ``Off`` re-enabled embedded mode |
| 72 | + request handling but did not undo that suppression, so the request |
| 73 | + reached the embedded mode code path in a child where Python, and the |
| 74 | + per-thread state it depends on, had never been initialised, causing a |
| 75 | + crash. ``WSGIRestrictEmbedded Off`` now marks Python as required in the |
| 76 | + Apache child processes, consistent with the other directives that need |
| 77 | + it, so embedded mode works as expected. As an additional safeguard, an |
| 78 | + embedded mode request that reaches a child with no initialised Python |
| 79 | + interpreter is now rejected with a ``500 Internal Server Error`` and |
| 80 | + logged as :ref:`WSGI0210` rather than crashing the process. |
0 commit comments