[Zope] ZServer (Zope 2.1.6) thread synchronization bug -- with workaround
Dr. Dieter Maurer
dieter@handshake.de
Thu, 8 Jun 2000 09:43:13 +0200 (CEST)
ZServer contains a thread synchronization bug
exposed when the HTTP streaming protocol
(i.e. RESPONSE.write) is used.
For large responses, the reponse is written
to a temporary file and the distribution
thread receives "file_part_producer" requests.
Writing to the tempfile uses "seek => write"
in the request thread; reading the tempfile
uses "seek => read" in the distribution thread.
The threads are not synchronized. This may
result in loss of response data: broken or buggy
images/files.
The following patch removes the use of
a tempfile. This, of cause, is only a
crude workaround.
Dieter
*******************************************************************
--- ZServer/:HTTPResponse.py Mon Jan 24 20:17:53 2000
+++ ZServer/HTTPResponse.py Thu Jun 8 09:01:31 2000
@@ -239,7 +239,9 @@
try:
if type(l) is type(''): l=string.atoi(l)
if l > 128000:
- self._tempfile=tempfile.TemporaryFile()
+ # don't! exposes a thread synchronization problem
+ # self._tempfile=tempfile.TemporaryFile()
+ pass
except: pass
stdout.write(str(self))