Hi,

I've run into an issue with a long-in-use mod_wsgi setup with WSGI daemon 
processes.  Specifically, the output of the application running under 
mod_wsgi does not appear to be passed through the configured Apache output 
filters, at least not with a rate limiting filter from the built-in 
mod_ratelimit.

Setup:
  -Ubuntu Trusty server, x86/64
  -Python 2.7.6 (plus backported fixes, standard Ubuntu security updates)
  -mod_wsgi v. 4.4.21

With a minimal Apache vhost config:

<VirtualHost *:80>
>     ServerAdmin [email protected]
>     ServerName bwtest.example.com
>     DocumentRoot /var/www/bwtest/public_html
>
>     ErrorLog /var/log/apache2/bwtest.example.com-error.log
>     CustomLog /var/log/apache2/bwtest.example.com-access.log combined
>
>     # Limit bandwidth to 4Mbps/512KBps for transferring data
>     SetOutputFilter RATE_LIMIT
>     SetEnv rate-limit 512
> </VirtualHost>
>

Downloads are limited to ~512KB/s as expected.  If I add a 
WSGIDaemonProcess to the config:

> <VirtualHost *:80>
>     ServerAdmin [email protected]
>     ServerName bwtest.example.com
>     DocumentRoot /var/www/bwtest/public_html
>
>     ErrorLog /var/log/apache2/bwtest.example.com-error.log
>     CustomLog /var/log/apache2/bwtest.example.com-access.log combined
>
>     # Limit bandwidth to 4Mbps/512KBps for transferring data
>     SetOutputFilter RATE_LIMIT
>     SetEnv rate-limit 512
>
>     WSGIDaemonProcess bwtest.example.com \
>         python-path=/usr/lib/python2.7 \
>         processes=3 threads=8 \
>         maximum-requests=1000 \
>         shutdown-timeout=60 \
>         display-name=bwtest.example.com
>     WSGIProcessGroup bwtest.example.com
>     WSGIScriptAlias / /var/www/bwtest/minimal.wsgi 
> </VirtualHost>
>

And an absolutely minimal WSGI application (just hardcoded into the .wsgi 
file) that transfers the same file: 

> import os.path
>
> BASEDIR = os.path.dirname(__file__)
> DATAFILE = os.path.join(BASEDIR, 'public_html', '64M')
>
> data = open(DATAFILE, 'rb').read()
>
> class TestApp(object):
>     def __call__(self, environ, start_response):
>         status = '200 OK'
>         response_headers = [
>             ('Content-type', 'application/octet-stream; charset=binary'),
>             ('Content-length', str(len(data))),
>             ('Content-Disposition', 'attachment; filename="64M.bin"'),
>         ]
>         start_response(status, response_headers)
>         return [data]
>
> application = TestApp()
>

... then the file is transferred at wire speed, seeming to bypass the 
mod_ratelimit output filter.

I realize 4.4.21 is not the current version, but the release notes for all 
more recent versions contain nothing about this.  I found nothing related 
in the mailing list archives.  Upgrading to the most recent mod_wsgi just 
to confirm that doesn't affect it will take some time because it has to go 
through acceptance testing.

Are Apache output filters supposed to work with mod_wsgi and a daemon 
process?

Thanks,

Charles

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to