From: | Andy Levine <ALevine [...] dynamicsoft.com> |
To: | poe [...] perl.org |
Subject: | PoCoCl::UserAgent, Protocol file://, and Solaris |
Date: | Tue, 1 Jun 2004 16:26:00 -0400 |
We are having a heck of a time getting PoCoCl::UserAgent to function
properly with the "file" protocol under Solaris. Under Linux and Cygwin our
apps work fine, under Solaris all file:// requests end with a "500
Connection reset" error.
Our environment is as follows:
Platform: Solaris 2.8/sparc
Perl: 5.8.3
Versions:
POE 0.2804
POE-Component-Client-UserAgent-0.05
libwww-perl-5.76
ParallelUserAgent-2.57
IO-Tty-1.02
URI-1.30
HTML-Tagset-3.03
HTML-Parser-3.36
Event-0.88
We have also tested other versions of perl (5.80), libwww (5.79) and POE
(0.27, 0.2802), all of which fail identically under Solaris, but work under
Linux and Cygwin.
Below is a tiny test application that demonstrates our problem:
--------- snip -----------------
#!/opt/dsProducts/ext/perl/5.8.3/bin/perl -w
sub POE::Kernel::ASSERT_DEFAULT { 1 };
sub POE::Kernel::TRACE_DEFAULT { 1 };
use strict;
use POE;
use POE::Component::Client::UserAgent;
# display tons of debugging messages. See 'perldoc LWP::Debug'
use LWP::Debug qw(+);
POE::Component::Client::UserAgent::debug(9);
POE::Component::Client::UserAgent->new(alias => "ua");
my($url) = "file:///tmp/test.txt";
sub _start {
my($postback) = $_[SESSION]->postback('_response');
my($request) = HTTP::Request->new(GET => $url);
$_[KERNEL]->post ("ua" => request =>
request => $request, response => $postback);
}
sub _response {
my ($request, $response, $entry) = @{$_[ARG1]};
print $response -> status_line;
$_[KERNEL] -> post (useragent => 'shutdown');
}
POE::Session->create(
package_states => [ main => [ "_start", "_response" ] ]
);
$poe_kernel->run();
Show quoted text
-------end snip ----------
A NON-POE, pure LWP::Parallel::UserAgent app, functions as expected,
returning the file.
Analysis of the debug logs from POE and LWP lead us to suspect the
POE::Kernel select() loop under Solaris is mistakenly setting the "exception
bit" on any call to select() for all reads and writes. This does NOT appear
to be the case for Linux:
------- snip ---------
<ev> Kernel::run() iterating. now(1.4333) timeout(0.1123)
then(1.5456)
<fh> ,----- SELECT BITS IN -----
<fh> | READ : 00000000
<fh> | WRITE : 00010000
<fh> | EXPEDITE: 00010000
<fh> `--------------------------
<fh> select hits = 2
<fh> ,----- SELECT BITS OUT -----
<fh> | READ : 00000000
<fh> | WRITE : 00010000
<fh> | EXPEDITE: 00010000
<fh> `---------------------------
<sl> found pending wr selects: 3
<sl> found pending ex selects: 3
------- end snip -----
Any help is greatly appreciated.
Thanks
Andy Levine