Subject: | LWP::ConnCache causes occasional RequestTimeouts |
Net::Amazon::S3 uses LWP::UserAgent with a keep_alive default of 10,
which tells LWP::ConnCache to maintain a pool of reusable HTTP connections.
This occasionally runs afoul of S3's Timeout limits.
The attached patch allows the caller to set the KEEP_ALIVE_CACHESIZE to
0. YMMV.
RequestTimeout: Your socket connection to the server was not read from
or written to within the timeout period. Idle connections will be
closed. at /usr/local/share/perl/5.8.8/Net/Amazon/S3/Client.pm line 90
Net::Amazon::S3::Client::_send_request('Net::Amazon::S3::Client=HASH(0xc4b0320)',
'HTTP::Request=HASH(0xc4c2508)') called at
/usr/local/share/perl/5.8.8/Net/Amazon/S3/Client/Object.pm line 153
Net::Amazon::S3::Client::Object::put_filename('Net::Amazon::S3::Client::Object=HASH(0xc4faeec)',
'/mnt/tmp/yamr/rdna12-i-1df4156a-4988-tsv2mysql/d/200703/0-200...')
called at /usr/local/share/perl/5.8.8/Amazon/AWS/S3.pm line 70
Amazon::AWS::S3::s3put('undef', 'bucket', 'rdna12.boxsentry.eu',
'key', 'db/d/200703/0-200703-job-2009-12-05T13:51:55-4988.tar',
'filename',
'/mnt/tmp/yamr/rdna12-i-1df4156a-4988-tsv2mysql/d/200703/0-200...')
called at /usr/local/share/perl/5.8.8/Amazon/AWS/YAMR.pm line 115
Subject: | configurable_keepalive.diff |
--- /usr/local/share/perl/5.8.8/Net/Amazon/S3.pm~ 2009-07-02 16:17:32.000000000 +0800
+++ /usr/local/share/perl/5.8.8/Net/Amazon/S3.pm 2009-12-05 13:30:29.000000000 +0800
@@ -140,12 +140,12 @@
has 'err' => ( is => 'rw', isa => 'Maybe[Str]', required => 0 );
has 'errstr' => ( is => 'rw', isa => 'Maybe[Str]', required => 0 );
+has KEEP_ALIVE_CACHESIZE => (is => 'rw', isa => 'Int', default => 10);
+
__PACKAGE__->meta->make_immutable;
our $VERSION = '0.52';
-my $KEEP_ALIVE_CACHESIZE = 10;
-
=head1 METHODS
=head2 new
@@ -196,14 +196,15 @@
my $ua;
if ( $self->retry ) {
$ua = LWP::UserAgent::Determined->new(
- keep_alive => $KEEP_ALIVE_CACHESIZE,
+ keep_alive => $self->KEEP_ALIVE_CACHESIZE,
requests_redirectable => [qw(GET HEAD DELETE PUT)],
);
$ua->timing('1,2,4,8,16,32');
} else {
$ua = LWP::UserAgent->new(
- keep_alive => $KEEP_ALIVE_CACHESIZE,
+ keep_alive => $self->KEEP_ALIVE_CACHESIZE,
requests_redirectable => [qw(GET HEAD DELETE PUT)],
);
}