Subject: | Tests are blocking in Windows 7 |
I am using:
* Strawberry-perl-5.12.2.0
* Perl 5, version 12, subversion 2 (v5.12.2) built for
MSWin32-x86-multi-thread
* Windows 7 Home Premium with Service Pack 1
* Plack-0.9974
I tried ”cpan> test Plack” and got the output:
...
Running make test
C:\strawberry\perl\bin\perl.exe "-MExtUtils::Command::MM" "-e"
"test_harness(0,
'inc', 'blib\lib', 'blib\arch')" t/*.t t/*/*.t
t/00_compile.t ................................. ok
t/HTTP-Message-PSGI/content_length.t ........... ok
t/HTTP-Message-PSGI/path_info.t ................ ok
t/HTTP-Message-PSGI/utf8_req.t ................. ok
t/HTTP-Server-PSGI/post.t ......................
and after some time:
cannot open port: 10608 at C:/strawberry/perl/site/lib/Test/TCP.pm line 83.
Then the test is blocked and it is impossible to close the windows with
CPAN.
I do not understand why the port can not be opened, but the blocking of
the test is typical using Windows 7. By the installation of Dancer and
Padre I saw similar problems with test using Test-TCP and for all with
the test of Test-TCP. The heavy use of fork and kill(9, $child) in
Test-TCP seem to be a problem.
See also: https://rt.cpan.org/Public/Bug/Display.html?id=66437 and
https://rt.cpan.org/Public/Bug/Display.html?id=66016.
My conclusion is that if you want to have portable Perl modules you have
to consider all systems to use. In Windows the emulation of fork is a
weak point.
Kill must be avoided, in portable perl code, because kill(9, $child) is
inherently unsafe for pseudo-processes used in Windows. See also
https://rt.cpan.org/Public/Bug/Display.html?id=66437#txn-911256 .
If you want to have an reliable and easy way to install things using
Test-TCP like Planck, the tests of Test-TCP and the way Test-TCP is used
must be changed.
So, at least until the emulation of fork in Windows is more safe, this
is important:
To add an advice to explicitly shut down child processes by the
implementation of modules intended to be portable. The purpose with this
is to avoid the related problem in the emulation of fork in Windows.
In the documentation of fork there could be a warning about the problem
and an reference to perlfork http://perldoc.perl.org/perlfork.html. In
perlfork there should be an advice to explicitly shut down child
processes and how to avoid using kill(9, $child).