Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
laziness, impatience, and hubris
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

I suspect that your cpu usage problem is related to this failure when running the Thread::Pool::Simple test suite:

c:\Perl\packages\Thread-Pool-Simple-0.23>nmake test Microsoft (R) Program Maintenance Utility Version 7.00.9466 Copyright (C) Microsoft Corporation. All rights reserved. C:\Perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harn +ess(0, 'blib\lib', 'blib\arch')" t\1.t t\2.t t\3.t t\4.t t\1....ok 1/0Can't call method "down" on unblessed reference at C:\Per +l\packages\Thread-Pool-Simple-0.23\blib\lib/Thread/Pool/Simple.pm lin +e 39. # Looks like your test died just after 1. t\1....dubious Test returned status 255 (wstat 65280, 0xff00) after all the subtests completed successfully t\2....ok 1/0Can't call method "down" on unblessed reference at C:\Per +l\packages\Thread-Pool-Simple-0.23\blib\lib/Thread/Pool/Simple.pm lin +e 39. # Looks like your test died just after 1. t\2....dubious Test returned status 255 (wstat 65280, 0xff00) after all the subtests completed successfully t\3....ok 1/0Can't call method "down" on unblessed reference at C:\Per +l\packages\Thread-Pool-Simple-0.23\blib\lib/Thread/Pool/Simple.pm lin +e 39. # Looks like your test died just after 1. t\3....dubious Test returned status 255 (wstat 65280, 0xff00) after all the subtests completed successfully t\4....ok 1/0Can't call method "down" on unblessed reference at C:\Per +l\packages\Thread-Pool-Simple-0.23\blib\lib/Thread/Pool/Simple.pm lin +e 39. # Looks like your test died just after 1. t\4....dubious Test returned status 255 (wstat 65280, 0xff00) after all the subtests completed successfully Failed Test Stat Wstat Total Fail Failed List of Failed ---------------------------------------------------------------------- +--------- t\1.t 255 65280 1 0 0.00% ?? t\2.t 255 65280 1 0 0.00% ?? t\3.t 255 65280 1 0 0.00% ?? t\4.t 255 65280 1 0 0.00% ?? Failed 4/4 test scripts, 0.00% okay. 0/4 subtests failed, 100.00% okay +. NMAKE : fatal error U1077: 'C:\Perl\bin\perl.exe' : return code '0x2' Stop.

This failure can be traced to this line from the T::P::S code:

my $self = &share({});

Which make the T:::P::S object a shared hash. The problem is that when a few lines later, it creates an instance of Thread::Semaphore and stores the returned handle into that hash:

$self->{shutdown_lock} = Thread::Semaphore->new();

Because the hash is shared, the blessedness of the Thread::Semaphore object is lost. Ie. It stops being a blessed scaler and becomes a plain ordinary scalar. And when it attempts to call a methd on that scalar:

$self->{shutdown_lock}->down(); ## line 39

it fails (Note:The line number is different because I added some debug:

???SCALAR(0x19a690c) Can't call method "down" on unblessed reference at C:\Perl\packages\Thread-Pool-Simple-0.23\blib\lib/Thread/Pool/Simple.p +m line 43.

This is a newly introduced bug that didn't exist when I tried T::P::Simple a few few weeks ago. Now, you can "fix" this test failure by upgrading to the latest CPAN versions of threads and threads::shared.

Unfortunately, with that upgrade, as with so many of the releases ever since they were dual lived, comes a different set of problems. The T::P::Simple now completes all its tests, but leaks memory like a sieve:

c:\Perl\packages\Thread-Pool-Simple-0.23>nmake test Microsoft (R) Program Maintenance Utility Version 7.00.9466 Copyright (C) Microsoft Corporation. All rights reserved. C:\Perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harn +ess(0, 'blib\lib', 'blib\arch')" t\1.t t\2.t t\3.t t\4. t\1....ok 1/0Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 t\1....ok t\2....ok 901/0Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 t\2....ok t\3....ok 901/0Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: 1 t\3....ok t\4....ok 2/0Scalars leaked: 1 t\4....ok All tests successful. Files=4, Tests=1805, 20 wallclock secs ( 0.00 cusr + 0.00 csys = 0.0 +0 CPU)

Which wouldn't be so bad if T::P::Simple was the only module affected, but with the latest versions of threads & threads::shared, programs that ran completely clean with 5.8.6 and its distributed version of threads/threads::shared, now leak like a sieve also..


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re: Multithreaded Script CPU Usage by BrowserUk
in thread Multithreaded Script CPU Usage by Zenshai

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others browsing the Monastery: (17)
    As of 2014-04-16 14:19 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (428 votes), past polls