LWP::Simple went haywire this morning

J

jwcarlton

I don't know if it's a server update or what, but sometime between 4am
and 8:30am, my Perl scripts that load LWP::Simple started having
errors.

The version of LWP::Simple currently running is 5.837.

Here's a complete test script that's giving such an error:

#!/usr/bin/perl

use LWP::Simple qw(!head);
use CGI qw:)standard);
use CGI::Carp qw(fatalsToBrowser);

$get_file = get("http://www.EXAMPLE.com/test.txt");
die "Couldn't get it!" unless defined $get_file;

print "Content-type: text/html\n\n";
print $get_file;
exit;


For this purpose, "test.txt" contains "Hello". Yes, I know that the
test could be done using OPEN, but it's just a test; the main scripts
are getting executed PHP files.

I've updated cPanel, reinstalled Perl, with no luck. The server is
semi-managed, and the management company has been working with me for
about 3 hours, but haven't found anything, either.

Any thoughts?
 
R

Randal L. Schwartz

jwcarlton> $get_file = get("http://www.EXAMPLE.com/test.txt");

....

jwcarlton> Any thoughts?


Yes. EXAMPLE.com is a reserved name by the IANA. That script cannot
possibly work as is.

And most likely, the problem is the remote server you are connecting to,
not this simple Perl script, so without a proper thing for us to run,
it's silly to ask *us* to debug what only *you* can run.

print "Just another Perl hacker,"; # the original
 
J

J. Gleixner

jwcarlton said:
I don't know if it's a server update or what, but sometime between 4am
and 8:30am, my Perl scripts that load LWP::Simple started having
errors.

The version of LWP::Simple currently running is 5.837.

Here's a complete test script that's giving such an error:

What error?
#!/usr/bin/perl

use LWP::Simple qw(!head);
use CGI qw:)standard);
use CGI::Carp qw(fatalsToBrowser);

$get_file = get("http://www.EXAMPLE.com/test.txt");
die "Couldn't get it!" unless defined $get_file;

print "Content-type: text/html\n\n";
print $get_file;
exit;

Anything in the Web server error/access logs?
Can you get there via telnet?
Try debug mode or LWP::Debug.
Remove CGI from the equation.

Many, many things to check/try. You're not showing us
any useful information. I'd start with network access
first, then the Web server, then fire up the debugger or
use LWP::Debug.
 
J

jwcarlton

What error?

There's no error message, it just dies and gives the die message.
Nothing shows in the error log for it.

Anything in the Web server error/access logs?
Can you get there via telnet?
Try debug mode or LWP::Debug.
Remove CGI from the equation.

I removed CGI completely (it wasn't needed for the test), but that had
no impact. I'm not familiar with debug mode, though. I tried adding
LWP::Debug, but there isn't any info for this module on CPAN, and I
don't know how to use it?

Many, many things to check/try. You're not showing us
any useful information. I'd start with network access
first, then the Web server, then fire up the debugger or
use LWP::Debug.

I did have a lot of "new" errors in the error log. One was related to
"head" being used in LWP::Simple and CGI, so I had to change "use
LWP::Simple" to "use LWP::Simple qw(!head)". Another is a PHP warning:

mysql_num_rows(): supplied argument is not a valid MySQL result
resource

These are both new as of today, even though none of my scripts have
changed.

I also just found a "new" error_log on my site, that's different from
the server's error log. This one just popped up today. It has a ton of
these warnings:

***
[04-Mar-2011 00:14:00] PHP Warning: session_start() [<a
href='function.session-start'>function.session-start</a>]: Cannot send
session cache limiter - headers already sent (output started at /home/
USERID/public_html/includes/variables.php:14) in /home/USERID/
public_html/includes/variables.php on line 14
[04-Mar-2011 00:14:00] PHP Warning: chmod() [<a
href='function.chmod'>function.chmod</a>]: Operation not permitted in /
home/USERID/public_html/includes/variables.php on line 18
[04-Mar-2011 00:14:00] PHP Fatal error: Call to undefined function
apache_request_headers() in /home/USERID/public_html/includes/
members.php on line 43
[04-Mar-2011 00:14:00] PHP Warning: Unknown: open(/tmp/
sess_3aee31fe86eb1fa10750b7f6361f572e, O_RDWR) failed: Permission
denied (13) in Unknown on line 0
[04-Mar-2011 00:14:00] PHP Warning: Unknown: Failed to write session
data (files). Please verify that the current setting of
session.save_path is correct (/tmp) in Unknown on line 0
****

By "ton", I mean 1.5MB in the last hour or so.

New oddity discovered. I have a second server with the same versions
of everything on it. I uploaded the test script above to an account on
the second server, getting a file from the first server, and the get
succeeded with no errors. But the same script on the first server,
getting a file from its own domain, has an error. So, I don't think it
can be easily duplicated; it's obviously an error on this server,
specifically.
 
J

jwcarlton

What error?

There's no error message, it just dies and gives the die message.
Nothing shows in the error log for it.
Anything in the Web server error/access logs?
Can you get there via telnet?
Try debug mode or LWP::Debug.
Remove CGI from the equation.

I removed CGI completely (it wasn't needed for the test), but that had
no impact. I'm not familiar with debug mode, though. I tried adding
LWP::Debug, but there isn't any info for this module on CPAN, and I
don't know how to use it?
Many, many things to check/try. You're not showing us
any useful information. I'd start with network access
first, then the Web server, then fire up the debugger or
use LWP::Debug.

I did have a lot of "new" errors in the error log. One was related to
"head" being used in LWP::Simple and CGI, so I had to change "use
LWP::Simple" to "use LWP::Simple qw(!head)". Another is a PHP warning:

mysql_num_rows(): supplied argument is not a valid MySQL result
resource

These are both new as of today, even though none of my scripts have
changed.

I also just found a "new" error_log on my site, that's different from
the server's error log. This one just popped up today. It has a ton of
these warnings:

***
[04-Mar-2011 00:14:00] PHP Warning:  session_start() [<a
href='function.session-start'>function.session-start</a>]: Cannot send
session cache limiter - headers already sent (output started at /home/
USERID/public_html/includes/variables.php:14) in /home/USERID/
public_html/includes/variables.php on line 14
[04-Mar-2011 00:14:00] PHP Warning:  chmod() [<a
href='function.chmod'>function.chmod</a>]: Operation not permitted in /
home/USERID/public_html/includes/variables.php on line 18
[04-Mar-2011 00:14:00] PHP Fatal error:  Call to undefined function
apache_request_headers() in /home/USERID/public_html/includes/
members.php on line 43
[04-Mar-2011 00:14:00] PHP Warning:  Unknown: open(/tmp/
sess_3aee31fe86eb1fa10750b7f6361f572e, O_RDWR) failed: Permission
denied (13) in Unknown on line 0
[04-Mar-2011 00:14:00] PHP Warning:  Unknown: Failed to write session
data (files). Please verify that the current setting of
session.save_path is correct (/tmp) in Unknown on line 0
****

By "ton", I mean 1.5MB in the last hour or so.

New oddity discovered. I have a second server with the same versions
of everything on it. I uploaded the test script above to an account on
the second server, getting a file from the first server, and the get
succeeded with no errors. But the same script on the first server,
getting a file from its own domain, has an error. So, I don't think it
can be easily duplicated; it's obviously an error on this server,
specifically.

I believe (he said with his fingers crossed) that the error is
resolved now. Turns out that it wasn't even on my end; it was the
management company's nameservers.

Thanks for your help, though, guys.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top