[Fwd: [Fwd: Memory problems using libwww's(5.36) HTTP Modules...]]

Paul Jobe (pjobe@grci.com)
Mon, 23 Nov 1998 17:00:47 -0500


Hello,

In a converstion in August 98, Randy Ray described problems with memory
management using
the libwww HTTP modules.
Has this solution been resolved ?

In the conversation it was noted that if you set the following variable
$DYNAMIC_FILE_UPLOAD,
chucks of files would be sent to browsers requesting such info.
I have edited the file in "/lib/perl/site_perl/HTTP/Request/Common.pm"
and didn't seem to
see any changes.

I am guessing this solution isn't feasible for what I am trying to do or

I am just missing something....?


Any suggestions are more than welcome...

Thanks,
Paul

>    ----------------------------------------------------------------
>
> Subject: Memory problems using libwww's(5.36) HTTP Modules...
> Date: Mon, 23 Nov 1998 14:27:54 -0500
> From: Paul Jobe <pjobe@popmail.da.grci.com>
> Reply-To: pjobe@grci.com
> Organization: GRC, International
> Newsgroups: comp.lang.perl.modules
>
> libwww 5.36
> perl 5.004_04
> Solaris 2.6 (Sparc 20)
>
> I 've tried using many of the examples found in books (Perl Cookbook
> pg. 691) and other sources
> (Daemon.pm) but yet have been able to find how to keep my program from
> consuming memory.
> Perhaps I am using these modules in an unintended way.
>
> I am using the HTTP modules from libwww to produce a " HTTP proxy
> server" in which the
> proxy credentials are stripped off from the HTTP protocol variables
> and pasted on a new URL.
> I have snipped out all that stuff and still see the program consume
> resources without
> relinguishing them using a simple GET statement....
>
> The problem becomes very apparent when passing huge files through it
> (128MB size 40 res - reported by "top").
>
> My initial assumption was that records were not being deallocated.
> Can forking such a process be beneficial ???
> Am I using these libraries in an unintended way ???
>
> Any ideas ???
>
> Thanks for any input,
> Paul
>
>
>
> #!/usr/local/bin/perl -w
> #
> # Condensed version of program
> #
>
> use strict;
> use HTTP::Daemon;
> use HTTP::Status;
>
> my $outputfile = "/home/user/OUTPUT.txt";
> my $NULLVALUE = "";
> my $port = 5020;
>
> my $server = new HTTP::Daemon
>            LocalAddr => 'myhost.com',
>            LocalPort => $port;
>
> print STDERR "Please contact me at: <URL:", $server->url, ">\n";
>
> while (my $client = $server->accept) {
>     open(OUTPUT, ">>$outputfile");
>     while (my $answer = $client->get_request) {
>         $client->autoflush;
>          # $server->autoflush; ??
>
>
>         if ($answer->method eq 'GET' and $answer->url->path =~
> /gnet*/) {
>             use LWP::UserAgent;
>             use HTTP::Request;
>             use HTTP::Response;
>
>             my $NURL=$answer->url->path;
>
>             my $uaGET = new LWP::UserAgent;
>             my $request = new HTTP::Request('GET', $NURL);
>             print OUTPUT "<<< REQUEST GET ($NURL) >>> \n";
>             my $response = $uaGET->request($request);
>             if ($response->is_success) {
>                  print $client $response->as_string;
>             }
>             else {
>                  print $client $response->error_as_HTML;
>             }
>              ###  Here's what I have tried ####
>             #        $response=();
>             #        $request=();
>             #        $response->content($NULLVALUE);
>             #        $response->content_type($NULLVALUE);
>             #
>         }
>     }
>     print OUTPUT "CLOSE: ", $client->reason, "\n\n";
>     $client->close;
>     #undef $client;
>     close(OUTPUT);
> }

--

*****************************************************************
* Paul Jobe                     GRC International, Inc.         *
* System Administrator          2940 Presidential Dr. Suite 390 *
* E-mail:  pjobe@grci.com       Fairborn, OH 45324-6223         *
* FAX: (937) 429-7769           PHONE:  (937)429-7773 ext 202   *
*****************************************************************

GRCI Disclaimer:
The opinions expressed herein are strictly those of the author
and do not necessarily reflect those of GRCI.