Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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"?

Thanks.

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 17.108.244.6] (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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2019-03-20 16:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How do you Carpe diem?





    Results (101 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!