Search code examples
perllwp

Perl LWP::Simple "Name or Service Not Known" error


Sometime in the past week I started getting an error with code that takes a URL and retrieves content.

This uses the Perl Module LWP::Simple

There were no changes to the module or to our code. The server host says nothing has changed.

It happens with http or https

It happens on more than domain we host.

It does NOT happen with a URL from another server.

This is the error

Result: $VAR1 = bless( { '_content' => 'Can\'t connect to coloradosportscards.ultimatecardstore.com:443 (Name or service not known) Name or service not known at /usr/local/share/perl5/LWP/Protocol/http.pm line 52. ',
'_rc' => 500,
 '_headers' => bless( { 'client-warning' => 'Internal response', 'client-date' => 'Sun, 02 Feb 2020 19:40:24 GMT',
 'content-type' => 'text/plain',
 '::std_case' => { 'client-warning' => 'Client-Warning', 'client-date' => 'Client-Date' } }, 'HTTP::Headers' ),
 '_msg' => 'Can\'t connect to coloradosportscards.ultimatecardstore.com:443 (Name or service not known)', '_request' => bless( { '_content' => '',
 '_uri' => bless( do{\(my $o = 'https://coloradosportscards.ultimatecardstore.com/online_store/store/images/0000697417.jpg')},
 'URI::https' ),
 '_headers' => bless( { 'user-agent' => 'Mozilla/5.0' },
 'HTTP::Headers' ), '_method' => 'GET' },
 'HTTP::Request' ) },
 'HTTP::Response' ); 

We are trying to access this image, which exists

https://coloradosportscards.ultimatecardstore.com/online_store/store/images/0000697417.jpg

Thanks in advance for looking

Mike


Solution

  • My Server people solved it. Not quite sure what they did but it worked.

    Could a Cpanel update have changed the environment. This did suddenly start happening with no changes to the code on my end.

    Yes, there is also a chance for that as cPanel upgrades suitable packages which are needed for the server hosting environment, however they would do that after extensive testing only. Since the mentioned error also points to 'Name or service not known' there is a chance that resolution is not happening correctly from inside the server. We have slightly added another resolver IP to the server now. Please check & see how it goes at your end.