http://qs1969.pair.com?node_id=662899


in reply to Re: threads hang
in thread threads hang

dude, nice one!

I wonder if what you've found tho' is perhaps a different issue, as what i have observed is subtly different to what you see.

what i was seeing was a different number of threads that would hang each time i ran the script. if i ran the script with 10 threads i would get about 4-7 threads that would hang.

thanks for your proposed solution and your effort in testing this out in multiple environments! unfort, in a production env with multiple 100's of thousands of customers (and this really being a one off deal) i wont have the opportunity to upgrade to 5.10.0. it is something to keep in mind for the future tho', and perhaps i can initiate a longer term initiative.

Replies are listed 'Best First'.
Re^3: threads hang
by BrowserUk (Patriarch) on Jan 17, 2008 at 16:17 UTC
    if i ran the script with 10 threads i would get about 4-7 threads that would hang.

    Quite possibly symptoms of the same problem on a multi-cpu system rather than my single cpu system?

    You could try addressing the issue that moritz raised, by changing your loop to:

    while( my $left = $q->dequeue_nb ) {

    And see if that helps any. If not, try generating a standalone demo of the problem (using ping) and post a perlbug report. Maybe whomever there fixed the problem for 5.10 will recognise the symptom and be able to offer a patch against 5.8.8?

    Beyond that, I can't see any way of avoiding the bug, as it also affects piped opens. The alternative might be to use NET::SNMP to do whatever the executable your using is doing. Perhaps too painful to reproduce?

    One thing that route does have going for it is a non-blocking mode that appears to work quite well, which mean that you could avoid using threads altogether.


    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.