Skip Menu |
 

This queue is for tickets about the HTTP-Server-Simple CPAN distribution.

Report information
The Basics
Id: 44961
Status: resolved
Priority: 0/
Queue: HTTP-Server-Simple

People
Owner: Nobody in particular
Requestors: hdp [...] cpan.org
Cc:
AdminCc:

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



CC: Hans Dieter Pearcey <hdp [...] weftsoar.net>
Subject: [PATCH] xdg reports select() is problematic on win32
Date: Sat, 11 Apr 2009 18:33:54 -0400
To: bug-HTTP-Server-Simple [...] rt.cpan.org
From: hdp [...] cpan.org
Download (untitled) / with headers
text/plain 1.1k
From: Hans Dieter Pearcey <hdp@weftsoar.net> --- lib/HTTP/Server/Simple.pm | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) diff --git a/lib/HTTP/Server/Simple.pm b/lib/HTTP/Server/Simple.pm index ad594c1..7ca560d 100755 --- a/lib/HTTP/Server/Simple.pm +++ b/lib/HTTP/Server/Simple.pm @@ -204,6 +204,22 @@ started process. Any arguments will be passed through to L</run>. =cut +my $HAS_TIME_HIRES; +my $HAS_OK_SELECT; +BEGIN { $HAS_TIME_HIRES = eval { require Time::HiRes; 1 } } +BEGIN { $HAS_OK_SELECT = $^O ne "MSWin32" } + +sub _background_sleep { + if ($HAS_TIME_HIRES) { + Time::HiRes::usleep(100_000); + } elsif ($HAS_OK_SELECT) { + select(undef, undef, undef, 0.1); + } else { + sleep 1; + } +} + + sub background { my $self = shift; require File::Temp; @@ -213,7 +229,7 @@ sub background { croak "Can't fork: $!" unless defined($child); if ($child) { while (eof($fh)) { - select(undef, undef, undef, 0.1); + _background_sleep(); seek($fh, 0, 0); } return $child; -- 1.6.1.2
Subject: Re: [rt.cpan.org #44961] the proposed patch does not work well
Date: Thu, 30 Apr 2009 17:06:21 +0200
To: bug-HTTP-Server-Simple [...] rt.cpan.org
From: kmx <kmx [...] volny.cz>
Download (untitled) / with headers
text/plain 337b
Hi, the proposed patch does not work with: - Win XP SP3 - strawberry perl (tested on 5.8.9 and 5.10.0) - current dev release HTTP-Server-Simple-0.38_03 (the patch seems to be included in it) During the test 01live.t it hangs up - in "background()" call while testing "SlowServer". Unfortunately I have not found any solution. -- kmx
Subject: Re: [rt.cpan.org #44961] [PATCH] xdg reports select() is problematic on win32
Date: Mon, 11 May 2009 12:14:29 +0200
To: bug-HTTP-Server-Simple [...] rt.cpan.org
From: kmx <kmx [...] volny.cz>
Download (untitled) / with headers
text/plain 563b
Hi, I have done some more testing and found out that with latest win32 strawberry perl (April 2009): 1) the latest stable version HTTP-Server-Simple-0.38 PASSES test 04cgi.t without any problem 2) development release HTTP-Server-Simple-0.38_03 that includes the above-mentioned patch HANGS UP during 01live.t To sum up: the latest stable releases 0.38 works OK while 0.38_03 does not work. Tested on strawberry perl with both 5.10.0.5 and 5.8.9.1 on WinXP (2 different boxes) + Win2003. Thus I have little doubts whether this patch is the right way. -- kmx
Download (untitled) / with headers
text/plain 524b
On Sat Apr 11 18:34:18 2009, HDP wrote: Show quoted text
> From: Hans Dieter Pearcey <hdp@weftsoar.net> > > - select(undef, undef, undef, 0.1); > + _background_sleep();
Could you please provide some evidence that the select() call above doesn't work on Windows. If it really doesn't, then it needs to be fixed, but from looking at win32/win32sck.c it looks like it is explicitly being handled, and a small test program seems to confirm this: for (1..30) { print "$_\n"; select(undef, undef, undef, 0.1); }


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.