[mod_python] strange util.FieldStorage() behavior

Gregory (Grisha) Trubetskoy grisha at modpython.org
Wed May 28 10:47:25 EST 2003


I just ran this test using mod_python 3.0.3 and Apache 2.0.45 (on RH 8.0),
I used ab (nice tool that comes with Apache) to run 100000 requests, and I
have not seen any grwoth (except initally, but that's normal) in httpd's
memory consumption.

Grisha

On Wed, 28 May 2003, Karsten Backhaus wrote:

> I'm using mod_python 2.7.8 with apache 1.3.27 under SuSE Linux 8.2
>
> i wrote a simple handler script that only parses its "cgi parameters"
> using util.FieldStorage() and returns apache.OK
>
> the script worked fine so far, but everytime the script runs, the memory
> used by apache rises a few kbyte.
>
> next i removed the util.FieldStorage() function from the script, with the
> result, that the memory usage remains constant.
>
> because of that i searched for an other way to get access to the committed
> form parameters and found the mod_python.publisher handler.
>
> i added the publisher handler to my apache config and wrote a file
> "hello.py" with the following content:
> --------
> """ Publisher example """
>
> def say(req, what="NOTHING"):
>     return "I am saying %s" % what
> -------
>
> now a request with the url http://localhost/hello/say?what=blahblah
> returns the expected "I am saying blahblah
>
> i wrote a script, that calls wget on that url within an endless loop:
> ------- getit.pl
> while(1) {
>         system("wget -O test.htm http://localhost/hello/say?what=blah");
> }
> -------
>
> next i wrote a verry simple "tool" that monitors memory usage of my
> http-servers
> ------- memwatch.pl
> while(1)
> {
>   open(OUTPUT, "ps -C httpd -o \"size= pid=\" |") or die "error: $!\n";
>   while(<OUTPUT>)
>   {
>     chomp();
>     my($first, $second) = split();
>     my($sec, $min, $hour) = localtime(time);
>     print "$hour:$min:$sec ", $first, "\t(", $second, ")\n";
>   }
>   sleep(1);
> }
> -------
>
> and, the unexpected happens, runnig memwatch.pl while running getit.pl
> shows the constant growing memory usage of the httpd processes.
>
> the longer the string after http://localhost/hello/say?what= is, the
> more the memory seems to grow each time.
>
> reading the docs, i found, that even mod_python.publisher uses the
> functionality of util.FieldStorage(), which i wanted not to use
> because of the strange things i figured out during my first test
> (abovementioned)
>
> for me at the moment this looks like a amemory leakage in
> util.FieldStorage. i searched the archive and did not found anything
> regarding that behavior.
>
> so my question is: Am I doing something wrong?
>
> thanks in advance
> Karsten
>
> _______________________________________________
> 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