Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

comment on

( [id://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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-04-20 01:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found