https://issues.apache.org/bugzilla/show_bug.cgi?id=48024

           Summary: mod_sed consumes too much memory when used inside
                    reverse proxy and line sizes are very long e.g. 1-5M
           Product: Apache httpd-2
           Version: 2.3-HEAD
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
        AssignedTo: [email protected]
        ReportedBy: [email protected]


This has been reported to me by Bram <[email protected]>

When Apache is used as a reverse proxy and mod_sed is used to filter
to content and the output contains lines which are really long e.g
1M-4M chracters in single line, mod_sed consumes too much memory.

Here is the snips of the mail from Bram :
- 1 mb file with only a newline at the end
$ perl -we '$\="\x0D\x0A"; print "a" x (1 * 2 ** 20);' > /var/www/a.1.bin

When the file is downloaded apache uses 70 mb of memory


- 2 mb file with only a newline at the end:
$ perl -we '$\="\x0D\x0A"; print "a" x (2 * 2 ** 20);' > /var/www/a.2.bin

When the file is downloaded apache uses 277 mb of memory


- 3 mb file with only a newline at the end:
$ perl -we '$\="\x0D\x0A"; print "a" x (3 * 2 ** 20);' > /var/www/a.3.bin

When the file is downloaded apache uses 608 mb of memory


- 4 mb file with only a newline at the end:
$ perl -we '$\="\x0D\x0A"; print "a" x (4 * 2 ** 20);' > /var/www/a.2.bin

When the file is downloaded apache uses 1070 mb of memory

------------------------------------------------

I am able to reproduce the issue with following configuration :

LoadModule sed_module modules/mod_sed.so
LoadModule headers_module  modules/mod_headers.so
LoadModule substitute_module  modules/mod_substitute.so
LoadModule proxy_module          modules/mod_proxy.so
LoadModule proxy_http_module     modules/mod_proxy_http.so

ProxyPass / http://hostname:8080/
<Location />
        Header unset Content-Length
        SetOutputFilter Sed
        OutputSed s/\(https:\/\/192.168.173.114\)\//\1:444\//g
</Location>

------------------------------------------------

The above doesn't have any impact if line sizes are small which is the typical
case with html or ascii text.

* Using core category because mod_sed component is not available.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to