Skip Menu |

This queue is for tickets about the Benchmark-Thread-Size CPAN distribution.

Report information
The Basics
Id: 34676
Status: resolved
Priority: 0/
Queue: Benchmark-Thread-Size

People
Owner: Nobody in particular
Requestors: imacat [...] mail.imacat.idv.tw
Cc:
AdminCc:

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



Subject: Use slee() Instead of <> To Wait Until Killed
Dear Elizabeth Mattijsen, Hi. This is imacat from Taiwan. I found that your Benchmark-Thread-Size-0.07 does not work when STDIN is not available, I.E. redirected from somewhere else, like /dev/null or files. Further investigation reveals that, when creating _test_ramthread in your Size.pm, in order to wait until killed, it listens from STDIN. This does not work when STDIN is attached to /dev/null or some other files. To wait forever, you should use sleep() instead. I attached the sample terminal log below. I made a simple patch to Benchmark-Thread-Size-0.07, in the hope that it helps. Please tell me if you have any question, or if I could be of any help. Thank you. imacat@rinse tmp/Benchmark-Thread-Size-0.07 % make test </dev/null t/Size01......1/8 Performing each test 2 times (ref) 1 0make: *** wait: No child processes. Stop. make: *** Waiting for unfinished jobs.... make: *** wait: No child processes. Stop. imacat@rinse tmp/Benchmark-Thread-Size-0.07 % perl -Iblib/lib -Iblib/arch t/Size01.t </dev/null 1..8 ok 1 - open script file ok 2 - write script ok 3 - close script ok 4 - check whether script exists ok 5 - run the test Performing each test 2 times (ref) 1 0 imacat@rinse tmp/Benchmark-Thread-Size-0.07 %
Subject: Benchmark-Thread-Size-0.07-nostdin.diff
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 diff -u -r Benchmark-Thread-Size-0.07.orig/lib/Benchmark/Thread/Size.pm Benchmark-Thread-Size-0.07/lib/Benchmark/Thread/Size.pm - --- Benchmark-Thread-Size-0.07.orig/lib/Benchmark/Thread/Size.pm 2003-12-29 06:54:19.000000000 +0800 +++ Benchmark-Thread-Size-0.07/lib/Benchmark/Thread/Size.pm 2008-04-05 03:08:57.000000000 +0800 @@ -271,7 +271,7 @@ threads->new( sub {print "started\\n"; sleep( 86400 )} ); } print "done\\n"; # make sure the world knows we're done - -<>; # make sure it waits until killed +sleep 86400 while 1; # make sure it waits until killed EOD close( $script ) or die "Could not close $testfile: $!\n"; -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkf2fPMACgkQi9gubzC5S1wS+gCeMFrzUGHjiHtDrkUYa1YUq6OG /dkAoK+TE8sf3Vu8x7Jr3WLBWT7ogeXL =WMDS -----END PGP SIGNATURE-----
Subject: Use sleep() Instead of <> To Wait Until Killed
Sorry, the subject should be "sleep()", not "slee()". Also, the result of this problem (<> to wait until killed) is that, when STDIN is redirected from /dev/null or some other file, _test_ramthread does not wait. The consequence of "no waiting" is that, ramthread1 always obtain 0 size for the exited _test_ramthread, the "while (!$size)" loop become endless. ramthread1 does not return because of entering the endless loop above, and your Benchmark-Thread-Size-0.07 does not work.
I've removed Thread::Benchmark::Size from CPAN recently. I have no intent of maintaining this module, nor am I sure of any usefulness anymore. Please check with Backpan if you want to have it still. I'm also open for any other maintainers. Please let me know if you're interested.