[mod_python] requests are blocking when using req.sendfile

Matt Barnicle mattb at wageslavery.org
Tue Sep 23 19:22:46 EDT 2008

> 2008/9/24 Matt Barnicle <mattb at wageslavery.org>:
>> well, there are a couple reasons why i didn't try that straight
>> away.  i'm not really the best at sysadmin type stuff.  if something
>> were to go wrong this is our one and only live server at the moment
>> so i avoid upgrading packages unless i know it's necessary.  i
>> didn't realize before but we're actually using v3.2.8.  it's pretty
>> recent, however if you think that the installing the latest version
>> is essential towards figuring out the problem i will do it.
> That is not pretty recent, it is 2 1/2 years old. There have one
> and one more significant release since then.

ok, noted...

> You can see what has changed or been fixed in between version you are
> using and latest version at:
>   http://www.modpython.org/live/current/doc-html/app-changes-from-3.2.10.html
>   http://www.modpython.org/live/current/doc-html/app-changes.html
> It may indeed not be necessary to upgrade, but it would have been a
> good start.

the other reason i didn't mention is more of a package management
reason.  we're using centos and the latest version available by yum
is the one that's installed now..  but i am now looking into it and
will attempt the manual download / install.

> When I get the chance I will look again at your post then and see
if I
> can work out what you are talking about. Be patient, I may not get
> to it straight away.
> Graham

ok, sure.  i assume that sort of thing anyway   :-)


>> - m@
>>> And what happens if you stop using an older version of mod_python
>>> and use the latest version?
>>> In other words, upgrade to mod_python 3.3.1 and then we may be
able to
>>> help. The older versions have various bugs in them and there is no
>>> point us trying to debug an issue that may have already been
>>> fixed.
>>> Graham
>>> 2008/9/23 Matt Barnicle <mattb at wageslavery.org>:
>>>> i'm having an issue with our site, which seems to be directly
>>>> related to using req.sendfile.  on our site, we have secure
>>>> music
>>>> downloads.  the user has to go through a series of steps in
>>>> order
>>>> to
>>>> gain access to the music (fyi, we run a legitimate service, not
>>>> a
>>>> pirate or warez site).  just some background info..  basically
>>>> we
>>>> can't offer a direct download link or the security can be
>>>> bypassed.
>>>> so downloading is done through the handler, which runs the
>>>> checks,
>>>> and if everything looks good, the file is sent to the browser
>>>> using
>>>> req.sendfile with the local path to the file on disk.
>>>> it works..  but the problem is, requests start backing up
>>>> whenever
>>>> a
>>>> download is being sent.  it looks like new requests are being
>>>> sent
>>>> to the apache process that is tied up sending the download file.
>>>> i
>>>> don't understand why this is happening though.  i would think
>>>> that
>>>> while it's sending the file, no new requests would be queued in
>>>> that
>>>> process.  i can verify this easily by downloading a file, and
>>>> while
>>>> it's downloading, clicking on a link on the site from the same
>>>> window in which i downloaded in.  the request will stay in the
>>>> WAIT
>>>> state (according to mod_status) until the download is finished,
>>>> then
>>>> the page will load and the queue will clear up.  now if i change
>>>> the
>>>> download link to a static file, served directly by apache, this
>>>> problem disappears.
>>>> what can i do to fix this?  it's a major issue right now.  many
>>>> times a day you can go to the site and it will hang for perhaps
>>>> 1
>>>> to
>>>> 3 minutes, then it will load, due to the above described
>>>> situation.
>>>> version notes:
>>>> CentOS release 5 (Final)
>>>> apache 2.2.3
>>>> mod_python 3.2
>>>> using prefork compiled into apache.  misc apache configuration:
>>>> KeepAlive Off
>>>> <IfModule prefork.c>
>>>>  StartServers       8
>>>>  MinSpareServers    5
>>>>  MaxSpareServers   20
>>>>  ServerLimit      256
>>>>  MaxClients       256
>>>>  MaxRequestsPerChild  4000
>>>> </IfModule>
>>>> thank you for your time and consideration..
>>>> - m@
>>>> _______________________________________________
>>>> Mod_python mailing list
>>>> Mod_python at modpython.org
>>>> http://mailman.modpython.org/mailman/listinfo/mod_python

More information about the Mod_python mailing list