in reply to SOLVED: Is this a bug of perl threads?

You seem to be think you can send a signal to a thread ("I interrupted one client with CTRL+C"). That's not the case. The signal is sent to the whole process, and the default action of most signals and SIGINT specifically is to kill the process.

If anything, the bug is on the Windows side. One could say Perl is handling the Ctrl-C as if it was emulating a process even when it's not.

Replies are listed 'Best First'.
Re^2: Is this a bug of perl threads?
by BrowserUk (Patriarch) on Mar 12, 2010 at 02:29 UTC
    If anything, the bug is on the Windows side. One could say Perl is handling the Ctrl-C as if it was emulating a process even when it's not.

    I read the OP to mean that he was interupting a client with ^C and that was having the side-effect of causing the server to terminate.

    With the only connection between the interupted client and the threaded server being a socket, I doubt that the ^C is being 'forwarded' to it.


    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.

      I read the OP to mean that he was interupting a client with ^C and that was having the side-effect of causing the server to terminate.

      Yes, that's what I mean.

        I don't know enough about socket comms on *nix, but can't accept return without a connection? For example, with ECONNABORTED.

        As all your server threads are using (cloned copies of) the same server socket backed by the same physical resource, is it possible that if one client aborts its connection, that could cause all your threads to receive that error from the accept, causing their while loops to terminate?


        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.
      No idea what I was thinking.
Re^2: Is this a bug of perl threads?
by Ray.Zachary (Acolyte) on Mar 12, 2010 at 02:31 UTC

    "The signal is sent to the whole process"? Is this mean that when I interrupt a client process, the signal SIG_INT will be send to the whole server process through the socket?

      No, I was just thoroughly confused.

      What's the exit status of the server (server.pl ; echo $?)? ( According to almut below, this would have indicated the server died from SIGPIPE. Have a problem? Check for errors! )

      Is there a parent-child relationship between the server and the clients?

      The fact that the same socket is being used by multiple threads is odd...

        The exit code is 141.