Skip to content

Commit db7fbc1

Browse files
Add Known Issues docs page covering daemon-mode chunked response truncation.
Document the long-standing limitation (issue #42) that in daemon mode a truncated chunked response, whether from an application exception or a daemon process crash, is still terminated with a final 0 chunk so the client cannot detect the truncation. The embedded-mode fix from 4.4.0 does not carry over because the client-facing chunked framing is applied in a separate process from where the response is produced. Place the new page in the Help and community section between troubleshooting and reporting-bugs, and cross-link both so it sits in the natural path: is it my install/config/app, then is it a known mod_wsgi defect, then report it.
1 parent a589b51 commit db7fbc1

4 files changed

Lines changed: 87 additions & 1 deletion

File tree

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Where to start
8686
:maxdepth: 1
8787

8888
troubleshooting
89+
known-issues
8990
finding-help
9091
reporting-bugs
9192
contributing

docs/known-issues.rst

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
============
2+
Known Issues
3+
============
4+
5+
This page lists known issues in mod_wsgi itself: confirmed defects and
6+
accepted limitations in the module, as opposed to problems in your
7+
Apache configuration or your WSGI application. If you are still working
8+
out *where* a problem lives, start with :doc:`troubleshooting`; the
9+
guides it links to cover installation, configuration, and application
10+
problems, which are far more common than bugs in mod_wsgi.
11+
12+
An issue is listed here when the behaviour is understood, there is
13+
nothing a user can do to make mod_wsgi behave differently beyond the
14+
noted workaround, and a full fix is either not yet available or not
15+
considered worthwhile. Each entry records the symptom, which mode of
16+
operation is affected, the underlying cause, any workaround, and the
17+
current status with a link to the tracking issue.
18+
19+
If you are hitting something that is not listed here and not explained
20+
by :doc:`troubleshooting`, see :doc:`reporting-bugs`.
21+
22+
.. _known-issue-chunked-truncation:
23+
24+
Truncated chunked responses are not signalled to the client in daemon mode
25+
--------------------------------------------------------------------------
26+
27+
**Symptom**
28+
29+
A WSGI application streams a response with no ``Content-Length`` header,
30+
so it is sent to the client using ``Transfer-Encoding: chunked``. If the
31+
response is then cut short partway through, the client still receives a
32+
syntactically complete chunked response, terminated with the final
33+
``0`` chunk, and cannot tell that the body was truncated. The response
34+
is cut short when either:
35+
36+
* the application raises an unhandled exception while iterating the
37+
response, or
38+
* the daemon process handling the request dies mid-response (for
39+
example, it is killed, crashes, or hits a resource limit).
40+
41+
**Affected mode**
42+
43+
Daemon mode only. In embedded mode this was addressed in version 4.4.0:
44+
when a chunked response is interrupted by an application exception,
45+
mod_wsgi suppresses the terminating ``0`` chunk so the client sees an
46+
unterminated response and can detect the truncation. Responses that do
47+
carry a ``Content-Length`` are not affected in either mode, because a
48+
client can already detect a short read against the declared length.
49+
50+
**Cause**
51+
52+
In daemon mode the response is produced in the daemon process and
53+
proxied back to the Apache child process over a socket, with the chunked
54+
framing toward the client applied by the Apache child. The response leg
55+
between daemon and child is an unframed byte stream whose end is
56+
signalled only by the socket closing, so a clean completion, an
57+
application exception, and an outright crash all look identical to the
58+
Apache child. The child then terminates the chunked response toward the
59+
client normally. The embedded-mode fix does not carry over because it
60+
acts in the daemon process, on a different request, from where the
61+
client-facing chunked framing is applied.
62+
63+
**Workaround**
64+
65+
Where it matters that a client can detect a truncated response, have the
66+
application set a ``Content-Length`` header so the response is not sent
67+
chunked; a client can then detect a short read against the declared
68+
length. This is only possible when the response length is known in
69+
advance.
70+
71+
**Status**
72+
73+
Open. A fix would require framing the daemon-to-child response leg so the
74+
Apache child can distinguish a truncated response from a clean one and
75+
withhold the terminating ``0`` chunk. The value of such a fix is limited
76+
in any case: chunked transfer encoding is hop by hop, so an intermediary
77+
proxy may dechunk and re-chunk the response and append its own
78+
terminating chunk, which would erase the truncation signal before it
79+
reaches the client. Tracked as
80+
`issue #42 <https://github.com/GrahamDumpleton/mod_wsgi/issues/42>`__.

docs/reporting-bugs.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ the GitHub issue tracker:
1010
A substantial fraction of bug reports against mod_wsgi turn out to
1111
be misconfiguration, application errors, or problems in third-party
1212
packages rather than mod_wsgi bugs. Before filing a bug report,
13-
work through :doc:`troubleshooting`.
13+
work through :doc:`troubleshooting`. If the behaviour does look like
14+
a defect or limitation in mod_wsgi itself, check :doc:`known-issues`
15+
first, as it may already be recorded there along with any workaround.
1416

1517
For general questions, or if you want to discuss whether something
1618
is actually a bug before filing it, see :doc:`finding-help`.

docs/troubleshooting.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ Additional pages that may help:
2525
approaches.
2626
* :doc:`user-guides/frequently-asked-questions` — common questions
2727
and gotchas.
28+
* :doc:`known-issues` — confirmed defects and accepted limitations
29+
in mod_wsgi itself, where the problem is not in your install,
30+
configuration, or application.
2831

2932
If none of these resolve the issue, see :doc:`finding-help` for
3033
where to ask.

0 commit comments

Comments
 (0)