Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re^8: Multithreaded Server Crashes under heavy load

by rmahin (Scribe)
on Aug 31, 2012 at 21:16 UTC ( #991086=note: print w/replies, xml ) Need Help??

in reply to Re^7: Multithreaded Server Crashes under heavy load
in thread Multithreaded Server Crashes under heavy load

Hey sorry about the CSV! I just opened it up in Libre Office as a comma delimited file, and it looked good. BUT! Good news. Think you're definitely right that I'm not closing connections properly. Think this is caused by commands that need to open other file handles, and not handling any errors correctly. For instance, I think the only command I included that has that behavior is the PUT command, which does  open( PUTFILE, ">$outfile" ) or threads->exit;. The threads->exit is clearly getting called, leaving the socket open. I fixed all those and added more messages to see when exactly it was happening, and it definitely seems to be working better. Have on more part of the code to look at using a subroutine that does not appear to be thread friendly, but will update on progress once I've determined if I solved it or not. Thanks for the direction!

Replies are listed 'Best First'.
Re^9: Multithreaded Server Crashes under heavy load
by BrowserUk (Pope) on Aug 31, 2012 at 21:39 UTC
    which does open( PUTFILE, ">$outfile" ) or threads->exit;. The threads->exit is clearly getting called, leaving the socket open.

    FWIW: I have written a crap load of threaded perl code and never had occasion to use thread->exit;. It is IMO redundant and dangerous.

    I would code that line as simply:

    open( PUTFILE, ">$outfile" ) or return;

    That way, all the normal perl cleanup will take place before the thread function returns and the thread terminates.

    Try it, it just might sort out a lot of your problems!

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    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.

    RIP Neil Armstrong

      Hey sorry for the late reply, but I think everything is working great now! I essentially did what you suggested so looks like that was what was killing me. Been running for a week and no problems. Thanks very much for the help.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://991086]
[LanX]: its the style attribute, I can't show you pm code, can only link to old everything docs of you want
[holli]: i'd like to keep my sanity, tyvm
[holli]: at least what's left off it :)
[LanX]: the+everything+ bible
[LanX]: http://web.archive .org/web/ 20071005212040/ http://www. Everything %20Diagram

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2017-11-20 21:47 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (294 votes). Check out past polls.