in reply to Re: threaded TCP server problem
in thread threaded TCP server problem

Thank you. After making over a dozen versions I didn't know what the problem was. You removed all cruft and made it nice.
I notice two problems:
1: $thrcnt does not increment.
2: on my system, it crashes on MS-Windows (ActivePerl-5.8.8.816)

Considering my approach.
The posted example is very lightweight, but in the real application the processing routine is timeconsuming and not lightweight. The number of connects are expected to be limited to <100/hour, and a restart every 24hours. Not a problem.

Replies are listed 'Best First'.
Re^3: threaded TCP server problem
by BrowserUk (Patriarch) on Mar 27, 2006 at 14:50 UTC
    1: $thrcnt does not increment.

    My mistake. I removed threads::shared to check something and forgot to put it back. Doing so will fix that and doesn't appear to cause much greater growth. With that put back it's ~ 7.7 MB after 10,000 connections.

    2: on my system, it crashes on MS-Windows (ActivePerl-5.8.8.816)

    I haven't tried AS 5.8.8 yet. I hadn't even noticed it was available. Maybe putting threads::shared back will help, though I don't see why it would. If you are on a multi-cpu system you should be locking the shared data before accesses, but that doesn't explain the crash without threads::shared.

    If the problem persists, I'd revert 5.8.6 which, (not yet having tried 5.8.8), is the most stable version I've used. Otherwise, you'll need the skills and internals knowledge of dave_the_m and the others on p5p to resolve the problem.

    One thing I have noticed is that if the client goes away without closing the connection, the thread will hang around and so consume memory. That may be curable by setting an appropriate timeout in IO::Socket somewhere?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      ActivePerl-5.8.8.816 contains a threads bug.
      They plan to release ActivePerl-5.8.8.817 in a few days
      Thank you very much.

      I checked a few things:
      ActivePerl-5.8.8.816 crashes
      ActivePerl-5.8.6.811 works fine

      (And some people wonder why I avoid using MS-Windows)
        (And some people wonder why I avoid using MS-Windows)

        But if the only variable is that the build of perl is different, is it really correct to blame Win32?

        Maybe the problem is that changes to perl do not get exercised as much under Win32 as posix platforms, so the bugs tend not to be discovered at the release candidate stage?


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.