Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Daemon problem: Can't locate object method "configure" via package "Net::HTTP"

by jspath (Initiate)
on Nov 07, 2008 at 16:27 UTC ( [id://722248]=perlquestion: print w/replies, xml ) Need Help??

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

We have a perl (v5.8.7) daemon, written using the CPAN module Daemon::Generic (v0.4), which is crashing daily. This daemon contantly checks for new entries to a table, and when it encounters them, will fork off a delivery process to run a GET or POST request using LWP::UserAgent (v2.033).

Normally, this works fine. However, last night, immediately before the crash, one of the delivery processes encountered the following error when trying to make a POST request:

500 Can't locate object method "configure" via package "Net::HTTP" Content-Type: text/plain Client-Date: Fri, 07 Nov 2008 03:26:27 GMT Client-Warning: Internal response 500 Can't locate object method "configure" via package "Net::HTTP"

This seems to indicate to me that the environment that the delivery processes are being created under is getting corrupted, which in turn takes down the entire daemon. Does this sound plausible? How could it happen? There is only one perl installation and one version of Net::HTTP on the machine. We are running on Ubuntu 6.06 LTS.

Our resident bestower of Perl wisdom is on vacation, so I humbly beg the Perl Monks for some sage advice in ridding my daemon of this demon!

Thanks alot!
Jim

Replies are listed 'Best First'.
Re: Daemon problem: Can't locate object method "configure" via package "Net::HTTP"
by Herkum (Parson) on Nov 07, 2008 at 16:44 UTC

    If I were you I would check the system you are trying to connect to. A 500 error implies that their web page is returning a Internal error which cascades onto you.

      A 500 can also imply that something failed in LWP::UserAgent:
      if ($use_eval) { # we eval, and turn dies into responses below eval { $response = $protocol->request($request, $proxy, $arg, $size, $timeout); }; if ($@) { $@ =~ s/ at .* line \d+.*//s; # remove file/line number $response = _new_response($request, &HTTP::Status::RC_INTERNAL_SERVE +R_ERROR, $@); } } ... sub _new_response { my($request, $code, $message) = @_; my $response = HTTP::Response->new($code, $message); $response->request($request); $response->header("Client-Date" => HTTP::Date::time2str(time)); $response->header("Client-Warning" => "Internal response"); $response->header("Content-Type" => "text/plain"); $response->content("$code $message\n"); return $response; }
      The "Client-Warning: Internal response" confirms that the problem is on my end, not the remote server end.
Re: Daemon problem: Can't locate object method "configure" via package "Net::HTTP"
by jspath (Initiate) on Nov 07, 2008 at 21:24 UTC
    It happened again this afternoon, with a similar, but slightly different error:
    501 Protocol scheme 'http' is not supported Content-Type: text/plain Client-Date: Fri, 07 Nov 2008 20:49:11 GMT Client-Warning: Internal response 501 Protocol scheme 'http' is not supported
    I'm working on trying to reproduce the problem, but it's tough since this is an error which "shouldn't" happen, and doesn't the majority of the time.
Re: Daemon problem: Can't locate object method "configure" via package "Net::HTTP"
by converter (Priest) on Nov 08, 2008 at 15:42 UTC

    In the first error you listed, the Net::HTTP package wasn't defined so the method lookup failed. Other than a compilation failure, what could cause the package to go missing? LWP::Protocol::http requires Net::HTTP and would fail if compilation of that module failed, no?

    Is it possible that you have an eval {} wrapper somewhere that's keeping your code from acting on an exception, or perhaps a __DIE__ handler that's doing the wrong thing?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://722248]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-03-28 16:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found