You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm experiencing intermittent failures with LWP::UserAgent: outgoing requests fail with a read timeout error after reaching the assigned timeout.
The error message is always the same: read timeout at /usr/share/perl5/vendor_perl/Net/HTTP/Methods.pm line 274.
There is no commonality in the target URLs except that they are all HTTPS, neither in the time, these failures happen intermittently and quite randomly. The same URL that worked the previous X times suddenly fails once. The most infuriating thing is that I can't reproduce it under experimental conditions, yet, the failures happen on the production servers a few times per day.
Relevant code that produces the faulty behavior:
my $ua = LWP::UserAgent->new(agent => 'some string');
$ua->env_proxy;
$ua->timeout(6);
my $http_payload = encode_json({
some => 'data',
});
$req->l->notice("payload:", $http_payload);
my $http_req = HTTP::Request->new;
$http_req->method('POST');
$http_req->uri($webhook_config->{url});
$http_req->authorization_basic($username, $password) if $username and $password;
# XXX headers not supported yet
# $http_req->header('Content-Type' => 'application/json; charset=UTF-8', @$headers); ## XXX or whatever the header storage format is
$http_req->header('Content-Type' => 'application/json; charset=UTF-8');
$http_req->content(Encode::encode('UTF-8', $http_payload));
my $http_res = $ua->request($http_req);
if (not $http_res->is_success) {
$req->l->error("Unsuccessful webhook call to $webhook_config->{url}: ".$http_res->status_line."\n".$http_res->decoded_content);
} else {
$req->l->notice("Webhook to $webhook_config->{url} successful");
}
The text was updated successfully, but these errors were encountered:
There's not much we can say about this unfortunately. Your code looks fine, and we don't see the server or the logs. I do think 6s is a rather short timeout. Is it possible the other end of the connection simply takes too long?
I'm experiencing intermittent failures with LWP::UserAgent: outgoing requests fail with a read timeout error after reaching the assigned timeout.
The error message is always the same:
read timeout at /usr/share/perl5/vendor_perl/Net/HTTP/Methods.pm line 274.
There is no commonality in the target URLs except that they are all HTTPS, neither in the time, these failures happen intermittently and quite randomly. The same URL that worked the previous X times suddenly fails once. The most infuriating thing is that I can't reproduce it under experimental conditions, yet, the failures happen on the production servers a few times per day.
Relevant code that produces the faulty behavior:
The text was updated successfully, but these errors were encountered: