Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Net-Amazon-S3 CPAN distribution.

Report information
The Basics
Id: 52454
Status: rejected
Priority: 0/
Queue: Net-Amazon-S3

People
Owner: Nobody in particular
Requestors: mengwong [...] pobox.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



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)], ); }
actually, upon further investigation, it appears that LWP::Conncache may be blameless -- with the keepalive set to 0, i still get s3put: about to call put for db/d/200703/0-200703-job-2009-12-05T23:47:56-13904.tar ... /mnt/tmp/yamr/rdna18-i-1df4156a-13904-tsv2mysql/d/200703/0-200703-job-2009-12-05T23:47:56-13904.tar i added a little debugging to S3::Client::Object: S3/Client/Object establishing http_request S3/Client/Object about to call send_request ... time passes ... 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(0xb6173bc)', 'HTTP::Request=HASH(0xb671384)') called at /usr/local/share/perl/5.8.8/Net/Amazon/S3/Client/Object.pm line 158 Net::Amazon::S3::Client::Object::put_filename('Net::Amazon::S3::Client::Object=HASH(0xb683bd8)', '/mnt/tmp/yamr/rdna18-i-1df4156a-13904-tsv2mysql/d/200703/0-20...') called at /usr/local/share/perl/5.8.8/Amazon/AWS/S3.pm line 72 :-( this is a fresh connection, it just seems to get wedged. odd, because the very same process previously succeeded in uploading things to S3. i'll try uploading it by hand and by calling the native Amazon::S3 library also.
On Sat Dec 05 10:52:21 2009, http://mengwong.com/ wrote: Show quoted text
> actually, upon further investigation, it appears that LWP::Conncache > may > be blameless
okay, this situation is redonkulous. from inside my script, it explodey. Show quoted text
> calling s3put
s3put: about to call put for db/d/200703/0-200703-job-2009-12-06T02:01:30-15175.tar ... /mnt/tmp/yamr/rdna19-i-1df4156a-15175-tsv2mysql/d/200703/0-200703-job-2009-12-06T02:01:30-15175.tar S3/Client/Object establishing http_request S3/Client/Object about to call send_request --- !!perl/hash:HTTP::Request _content: !!perl/code '{ "DUMMY" }' _headers: !!perl/hash:HTTP::Headers authorization: AWS 0EYN8G2ZYQV866CV28R2:nqtSYrfLYoolIDWkzEqQaY9IqHA= content-length: 30720 content-md5: FVv9CAQ6Z7N35Cqc1Mu9sw== content-type: binary/octet-stream date: 'Sat, 05 Dec 2009 18:01:31 GMT' x-amz-acl: private _method: PUT _uri: !!perl/scalar:URI::http http://rdna19.boxsentry.eu.s3.amazonaws.com/db%2Fd%2F200703%2F0-200703-job-2009-12-06T02%3A01%3A30-15175%2Etar 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(0xb61be6c)', 'HTTP::Request=HASH(0xc1a1748)') called at /usr/local/share/perl/5.8.8/Net/Amazon/S3/Client/Object.pm line 159 Net::Amazon::S3::Client::Object::put_filename('Net::Amazon::S3::Client::Object=HASH(0xc1a1b50)', '/mnt/tmp/yamr/rdna19-i-1df4156a-15175-tsv2mysql/d/200703/0-20...') called at /usr/local/share/perl/5.8.8/Amazon/AWS/S3.pm line 72 Amazon::AWS::S3::s3put('undef', 'bucket', 'rdna19.boxsentry.eu', 'key', 'db/d/200703/0-200703-job-2009-12-06T02:01:30-15175.tar', 'filename', '/mnt/tmp/yamr/rdna19-i-1df4156a-15175-tsv2mysql/d/200703/0-20...') called at /usr/local/share/perl/5.8.8/Amazon/AWS/YAMR.pm line 165 Amazon::AWS::YAMR::Workflow::__ANON__('Amazon::AWS::YAMR::Workflow=HASH(0xbe57e98)', 'o/200703/d-200703-job-2009-12-06T02:01:29-15175.tar', 'd/200703/d-200703-job-2009-12-06T02:01:29-15175.tar', 'd/200703/4-200703-job-2009-12-06T02:01:29-15175.tar', 'o/200703/7-200703-job-2009-12-06T02:01:29-15175.tar', 'd/200703/7-200703-job-2009-12-06T02:01:29-15175.tar', 'o/200703/3-200703-job-2009-12-06T02:01:29-15175.tar', 'o/200703/1-200703-job-2009-12-06T02:01:29-15175.tar', 'o/200703/c-200703-job-2009-12-06T02:01:29-15175.tar', ...) called at /usr/local/share/perl/5.8.8/Amazon/AWS/YAMR.pm line 290 Amazon::AWS::YAMR::Job::run('Amazon::AWS::YAMR::Job=HASH(0xb9be3a4)') called at /opt/rdna/yamr-runrdna line 138 when i run it from the command line, it works. 20091206-02:01:52 root@i-1df4156a:/mnt/boxsentry/s3# perl -MNet::Amazon::S3 -le 'my $s3client = Net::Amazon::S3::Client->new(s3=>Net::Amazon::S3->new({ aws_access_key_id => `head -1 $ENV{HOME}/.awssecret | xargs echo -n`, aws_secret_access_key => `tail -1 $ENV{HOME}/.awssecret | xargs echo -n`, retry => 1})); my $bucket = $s3client->bucket(name => shift); my $obj = $bucket->object(key => shift); $obj->put_filename(shift);' rdna19.boxsentry.eu db/d/200703/0-200703-job-2009-12-06T02:01:30-15175.tar /mnt/tmp/yamr/rdna19-i-1df4156a-15175-tsv2mysql/d/200703/0-200703-job-2009-12-06T02:01:30-15175.tar Net::Amazon::S3: keep_alive_cachesize = 10 S3/Client/Object establishing http_request S3/Client/Object about to call send_request --- !!perl/hash:HTTP::Request _content: !!perl/code '{ "DUMMY" }' _headers: !!perl/hash:HTTP::Headers authorization: AWS 0EYN8G2ZYQV866CV28R2:SuF3ei33UY7ilVW9UhtARUYiqZU= content-length: 30720 content-md5: FVv9CAQ6Z7N35Cqc1Mu9sw== content-type: binary/octet-stream date: 'Sat, 05 Dec 2009 18:35:48 GMT' x-amz-acl: private _method: PUT _uri: !!perl/scalar:URI::http http://rdna19.boxsentry.eu.s3.amazonaws.com/db%2Fd%2F200703%2F0-200703-job-2009-12-06T02%3A01%3A30-15175%2Etar S3/Client/Object got back http_response 20091206-02:35:48 root@i-1df4156a:/mnt/boxsentry/s3# i believe this is what they call a Bohrbug. I hereby retract this bug report. Maybe I am out of filehandles. wtf.
Thanks for the bug report. Rejecting as you can not duplicate ;-) Leon