CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
Queue dies with unexpected output

 



vmraj
New User

Jun 24, 2010, 5:19 AM

Post #1 of 1 (2582 views)
Queue dies with unexpected output Can't Post

Hi,

I have a queue server script written using POE::Session. The queue server dies with a weird return value and this behavior is not predictable.

The expected output of the url sent to the queue is always '1'. But sometimes the following Http::Response is received (unexpected output)
Wrong response:
HTTP/1.1 200 OK
Cache-Control: private
Connection: close
Date: Fri, 18 Jun 2010 11:19:33 GMT
Content-Encoding: gzip
Content-Type: text/plain;charset=utf-8
P3P: policyref="/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV
TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL
UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"

2????

===================================
Successful Http::Response:
Cache-Control: private
Connection: close
Date: Mon, 21 Jun 2010 11:20:12 GMT
Content-Encoding: gzip
Content-Type: text/plain;charset=utf-8
P3P: policyref="/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"

1

===================================

The code Snippet: (where queue waits for the response)

Code
  POE::Session->create 
( inline_states =>
{ _start => sub {
my ( $kernel, $heap ) = @_[ KERNEL, HEAP ];

# Post a request to the HTTP user agent component. When the
# component has an answer (positive or negative), it will
# send back a "got_response" event with an HTTP::Response
# object.

$heap->{www_time_start} = [gettimeofday];

$kernel->post( "BY-ua" => request => got_response => GET $url );

$self->queue_stats("enqueue", $url);
},

# A response has arrived. Display it.

got_response => sub {
my ( $heap, $request_packet, $response_packet ) =
@_[ HEAP, ARG0, ARG1 ];

my $http_request = $request_packet->[0];
my $http_response = $response_packet->[0];

my $iv = tv_interval ($heap->{www_time_start});

my $url_iv = sprintf "%s=%.2f",
substr($http_request->url(), -10), $iv;

DEBUG "Response time: $iv";

# Make the response presentable, and display it.
DEBUG "Received result for ", $http_request->url(), ": ",
$http_response->as_string();
},
);


Any pointers on how to resolve this issue ?

Thanks

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives