Re: [BUG] Losing GET/POST-data
Hello. I have posted a note here before, and want to thank those that took time to try to solve this strange problem, but unfortunately none of the suggestions have helped us so far, except for helping us ruling out things that could have been incorrect. Now I have received some more information since the last time so I'll try again. I have tried to be brief, but this is a complicated problem so it does need some text to fully understand. Basically we are losing data sent to a mod_perl program. We request the page "page.fxml?name=al&adress=sweden&problem=huge". When our program receives this request it will only be "page.fxml" without any of the arguments sent. Ok, first of all, yes we use the extension fxml - we want to mix non-mod_perl files among my mod_perl files so we have set the apache up to run mod_perl only on .fxml extension files. Works fine (apart from our problem), but the problem happens even when we parse all files. Second, we dont get this problem all the time. It occurs very infrequently and (what appears to be) for total random reasons. On one machine (we have several installations of this program) we will get the error 5 minutes after the machine started up and after a restart not for 24 hours. On one we will get it after 5-10 requests being sent to the apache server after restart and on another not a single error for 24 hours of continous very hard use (test scripts accessing like mad). Third, which might be important, we almost always use vhosts to set up different instances of sites that will run the code. We have a temporary solution to the problem, being that we restart the server every second hour. This has reduced the number of errors we get, but not eliminated them. One day (24 hour period) we can have 100-150 errors on one site, orther days we can get 700-800 errors (when we send roughly 17500 requests to the server during this time period). And this is when we do the restarts every sencond hour. If we don't the amount of errors will be up to almost half of the requests. The apache logs the request correctly to the access log but when we try to access the arguments in mod_perl they will just not be there anymore. We assume that the apache hands the data over to mod_perl who then hand it over to our program, this is what seems to go wrong on occasion. What we would like to do is find a way to track a request all the way through the apache and mod_perl to, finally, our program. Can this be done easily? Has anyone else encountered a problem like this? Does anyone know anything about this problem? Help! :o) - Technical information: Solaris/mod_perl 1.25/apache 1.3.19 Debian GNU/Linux, latest stable/mod_perl 1.26/apache 1.3.23 Both use Perl 5.6.1 lines from the httpd.conf file: PerlModule MyProjects::Project1 sethandler perl-script perlhandler MyProjects::Project1::handler options execcgi followsymlinks includes --- lines from the Project1.pm file: sub handler($) { $^W = 1; # gripe about the little things my $r = shift; my $apr; my %parm; $apr = Apache::Request->new($r); if($r->method() eq 'POST' || $r->method() eq 'GET') { my @keys = $apr->param(); foreach my $key (@keys) { $parm{$key} = $apr->param($key); print STDERR "Inargs: $key = " . $parm{$key} . "\n"; } } . . . --- (this will from time to time not generate anything) Thankful for any and all help that can help us find this annoying problem. /Hakan - Hi! I'm a .signature virus! Copy me into your .signature file to help me spread!
Re: [BUG] Losing GET/POST-data
On Wed, 2 Oct 2002, Wes Cravens wrote: > On 02 Oct 2002 15:23 GMT I wrote: > > > > > Hi! > > > > We're developing a perl module for apache/mod_perl, but have encountered a > > really strange problem. > > > > After 'a while' we seem to lose the data sent to the apache-server, at > > least it never reaches our module. > > > > > Recently we switched from using the standard Apache request-object to > > using the Apache::Request one, for the added functionality, but this has > > not had any effect at all as far as we can tell, and the bug keeps > > happening... > > I ran into a problem that the param parts of a request were flushed > when read for the first time... so if you lose them (don't store them) > then you cannot access them again. Yep, noticed this myself when re-writing it to check the input, should have posted this first perhaps, but anyway, this is basically how we handle the input: sub handler($) { $^W = 1; # gripe about the little things my $r = shift; my %parm; if ($r->method() eq 'POST') { %parm = $r->content(); } elsif ($r->method() eq 'GET') { %parm = $r->args(); } And now, after the re-write with Apache::Request sub handler($) { $^W = 1; # gripe about the little things my $r = shift; my $apr; my %parm; $apr = Apache::Request->new($r); if($r->method() eq 'POST' || $r->method() eq 'GET') { my @keys = $apr->param(); foreach my $key (@keys) { $parm{$key} = $apr->param($key); } } So.. I can't really see how that would make us lose the parameters, especially since we doesn't lose them all the time, which was the case when I tried to get the same value twice... [Back to Wes] > If you are not already, then try > > $apr = HTTP::Request->instance($r); instead... > We use ->new now. Since we always only create one instance of it I thought there was no difference. Is instance known to be safer or so? Also got the hint that this could somehow be connected to caching, but since we when we output debug-messages see that handler() is called, with no parameters in $r, I don't see how this could be. Any comments, and suggestions of fix if this might be the problem? Thanks again, Hakan ([EMAIL PROTECTED]) - Hi! I'm a .signature virus! Copy me into your .signature file to help me spread!
[BUG] Losing GET/POST-data
Hi! We're developing a perl module for apache/mod_perl, but have encountered a really strange problem. After 'a while' we seem to lose the data sent to the apache-server, at least it never reaches our module. We have absolutely no idea what might be causing this, and we realize it isn't an easy question to ask either, since we have never been able to reproduce the error on command. Sometimes it's there, sometimes not. It seems to come more frequently when the apache has been up and running for quite some time though, so our current 'solution' is to restart the apache every 3rd hour, but this doesn't completely solve the problem either. We have encountered the bug on several versions of both apache and mod_perl, on different os's: Solaris/mod_perl 1.25/apache 1.3.19 Debian/mod_perl 1.26/apache 1.3.23 We have also seen it both in the compiled versions and in the standard distributions. Recently we switched from using the standard Apache request-object to using the Apache::Request one, for the added functionality, but this has not had any effect at all as far as we can tell, and the bug keeps happening... It is possible that it has increased somewhat with increased number of vhosts, but we can't say for sure. Our perl module is 2k+ lines of perl-code, using other self-made modules of another 6k+ lines, + several standard modules, if that is of any help. Everything else seems to be fine, and no error-logs show anything. We have searched plenty on the web, in mailing list archives and such, but have so far never seen it mentioned. Does anyone at all know what this could be? Any pointers at all regarding any possible solution to this problem would be much appreciated. Thanks, Hakan Nilsson [EMAIL PROTECTED] - Hi! I'm a .signature virus! Copy me into your .signature file to help me spread!