I finally got around to have a look at this code and the first thing that jumped out and screamed at me was that you are blocking in client_start whilst reading and parsing the CSV input file. What is happening is that the while loop blocks the kernel, whilst you are enqueuing the requests to PoCo-Client-HTTP. These requests are sitting enqueued until the while loop ends and client_start finishes and then in one big whoosh are executed.

As you appear to be using strace to diagnose the problem you are using Linux I guess, so you can use POE::Wheel::ReadWrite and POE::Filters to parse your input file and be a lot more co-operative

Only amendments shown:
use POE qw(Wheel::ReadWrite Filter::Stackable Filter::Line Filter::CSV +); # add extra handlers for "file_input" "file_error" POE::Session->create( inline_states => { _start => \&client_start , _stop => \&client_stop , got_response => \&client_got_response , transfer_complete => \&finalize_transfer , file_input => \&file_input , file_error => \&file_error } ); sub client_start { my ($kernel, $heap) = @_[KERNEL, HEAP]; ## $poe_kernel->sig(INT => "_stop"); my $fh = IO::File->new( 'dealermade_pictures.csv', 'r' ); $heap->{file} = POE::Wheel::ReadWrite->new( Handle => $fh, Filter => POE::Filter::Stackable->new( Filters => [ POE::Filter::Line->new(), POE::Filter::CSV->new(), ], ), InputEvent => 'file_input', ErrorEvent => 'file_error', ); $heap->{_header} = 0; return; } sub file_input { my ($kernel,$heap,$fields) = @_[KERNEL,HEAP,ARG0]; unless ( $heap->{_header} ) { $heap->{_header}++; return; } my ( $picid, $url, $lot, $is_primary ) = @$fields; my $temp = generate_tempname( $url ); if ( -e $temp && -f $temp && -s $temp ) { $kernel->post( dmua => request => got_response => HEAD( $url ) +); } else { $kernel->post( dmua => request => got_response => GET( $url, Ac +cept => 'image/*' ) ); } return; } sub file_error { my ($kernel,$heap) = @_[KERNEL,HEAP]; delete $heap->{file}; return; }

The reading and parsing of the input file is now asynchronous and HTTP requests are enqueued and happening asynchronously whilst the input file is being read.


In reply to Re: POE Component HTTP problem by bingos
in thread POE Component HTTP problem by EvanCarroll

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.