[Twisted-Python] Twisted-webserver hangs when serving big files

Christopher Armstrong radix at twistedmatrix.com
Sat Jun 7 05:54:10 MDT 2003


On 2003.06.07 07:05, Thomas Weholt wrote:
> My code hangs when the request is for big files. Smaller ones like JPEGs
> etc. is ok, but for a test-file on approx. 33MB it just hangs and starts
> chewing up memory. The files are stored in a folder called wwwroot in the
> same folder as the source file. I'm using Twisted 1.0.5.

Why aren't you using the static.File resource? Subclassing Request is the 
wrong (and a *horrible*) way to write custom web code, to say nothing about
the fact that you're reimplementing what twisted already supports (non-blocking
file transfer support in twisted.web.static.File).

Anyway, the reason that this code is broken is probably because it repeatedly
does blocking reads until the entire file is read. 


-- 
 Twisted | Christopher Armstrong: International Man of Twistery
  Radix  |          Release Manager,  Twisted Project
---------+     http://twistedmatrix.com/users/radix.twistd/




More information about the Twisted-Python mailing list