Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Apache2::Request Internal apreq error

by evergreen (Novice)
on Mar 13, 2019 at 23:12 UTC ( #1231238=perlquestion: print w/replies, xml ) Need Help??

evergreen has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks,

I am using Apache2::Request to parse a multi-part Http post in a .mpl script running under apache mod_perl. The Http post comes from an upstream system.

Here is the relevant part of the script.

$r = shift; $cgi = Apache2::Request->new($r); $r->discard_request_body; # efficiently parses the request body my $parser_status = $cgi->param_status(); if ($parser_status ne 'Success') { $parser_error = $parser_status; }

The problem is that the call to param_status() returns "Internal apreq error" and further down in the script, it finds that an expected multi-part content is missing.

The post is retried by the upstream system until it succeeds, and after 10-15 retries it eventually succeeds, meaning there was no apreq error when it succeeded and the expected multi-part is present.

Is there any way to get more information about why there is an "Internal apreq error"?


Replies are listed 'Best First'.
Re: Apache2::Request Internal apreq error
by thanos1983 (Parson) on Mar 14, 2019 at 09:05 UTC

    Hello evergreen,

    My answer is not Perl related but my troubleshooting approach on this would be to capture a tcpdump (LinuxOS) if you are running on (WindowsOS) wireshark. By doing so you will see the package arriving and you will explicitly see what is the reply/error back.

    Update: From the documentation Apache2::Request/param this should give more data:

    $req->args_status(1); # set error state for query-string parser ok $req->param_status == 1; $foo = $req->param("foo"); ok $foo == 1; eval { @foo = $req->param("foo") }; ok $@->isa("Apache2::Request::Error"); undef $@; eval { my $not_found = $req->param("non-existent-param") }; ok $@->isa("Apache2::Request::Error"); $req->args_status(0); # reset query-string parser state to "success"

    Hope this helps, BR.

    Seeking for Perl wisdom...on the process of learning...not there...yet!
      Thanks thanos1983, I tried tcpdump and Wireshark, but the content of the post requests looks good and the multi-part attachments are there, but somehow it is not being parsed.

      I also see this in apache error log:
      [Thu Mar 14 18:40:04 2019] [error] [client] (70008)Partia +l results are valid but processing is incomplete: ap_get_brigade fail +ed during prefetch [Thu Mar 14 18:40:04 2019] [error] Internal apreq error
      Will update here if I find anything.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1231238]
Approved by stevieb
Front-paged by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2019-10-19 06:24 GMT
Find Nodes?
    Voting Booth?