You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-dev@httpd.apache.org by Alexander Poquet <at...@csbd.org> on 2005/02/24 02:45:56 UTC

libapreq2 2.04-dev, Apache::Request::param resolver error

Hey folks.  I'm in the process of upgrading my application to mod_perl2, and
I'm getting some strange behaviour from Apache::Request::param (and also
Apache::Request::args).  Basically, when I run the simple test case that I've
patched in below, I get the following cryptic error:

Apache::Request::param: (137087408) Unknown resolver error at /var/www/root/test.pl line 18

I get nearly the same error when I replace the call to param with args:

Apache::Request::args: (137087408) Unknown resolver error at /var/www/root/test.pl line 18

And the following when replaced with body:

apache request error: Apache::Request::body: (12) Cannot allocate memory at /var/www/root/test.pl line 18

The args() call does work when called in a scalar context.  I basically have no
idea what is causing this, or where to look.  I'm pretty fluent in C and Perl,
but have very little experience with xs, so I don't even really know how to
trace the call through the perl glue and into the guts of it to (hopefully)
find the root cause of the problem.

An unknown resolver error, as far as I can tell, happens when herror() or
hstrerror() are given (through h_errno or through an argument, respectively)
an error code > 4.  I don't really know what it means, but what I do know is
that neither of these two functions seem to be called by the libapreq2 tree
at all.

I'm not supplying any POST data, so I would expect there to be much for body()
to parse, but an out of memory error is a little bit bizarre.  Also, in the
case of args, should such a huge and seemingly random number be passed as an
error code?  I'm wondering if maybe the reason I'm getting such a strange and
seemingly random error message (Unknown resolver) is simply because that error
number is totally random ... and certainly > 4.

I'm running Apache 2.0.52 on Debian Sarge on x86.

Anyway, here's test.pl:
---- BEGIN ----
#!/usr/bin/perl

use strict;
use warnings;

use Apache2;
use Apache::Request;
use Apache::RequestRec;
use Apache::RequestIO;
use Apache::Const qw(OK);

BEGIN:
{
        my $r = shift;
        my $apr = Apache::Request->new($r);
        my @foo;

        eval { @foo = $apr->param("foo") };

        if ($@ && ref($@) && $@->isa("Apache::Request::Error")) {
                $r->content_type("text/plain");
                $r->print("apache request error: $@\n");
                return OK;
        }

        $r->content_type("text/plain");
        $r->print("hello, world\n");
        $r->print("$foo[1]\n");
}

1;
---- END ----

Any help anyone could give me on this problem would be greatly appreciated.
It's driving me nuts.

Thanks,
Alexander

Re: libapreq2 2.04-dev, Apache::Request::param resolver error

Posted by Joe Schaefer <jo...@sunstarsys.com>.
atp@csbd.org (Alexander Poquet) writes:

> Hey folks.  I'm in the process of upgrading my application to
> mod_perl2, and I'm getting some strange behaviour from
> Apache::Request::param (and also Apache::Request::args).  Basically,
> when I run the simple test case that I've patched in below, I get the
> following cryptic error: 
>
> Apache::Request::param: (137087408) Unknown resolver error at
> /var/www/root/test.pl line 18 

Looking at the apr_strerror source, it appears that 
"Unknown resolver error" is a catchall error code triggered
by bogus numbers like that 137087408.  So I suspect the
resolver (h_errno) isn't at all relevant to the problem.

I suggest you test it against our subversion trunk, and 
double-check that the mod_apreq.so you are using is the
latest one.  Otherwise lets have a look at the actual query
string you are using; perhaps apreq_parse_query_string
is corrupting some memory during parsing?

-- 
Joe Schaefer