[mod-lisp-devel] Re: [tbnl-devel] Odd behavior (socket leak)

Marc Battyani marc.battyani at fractalconcept.com
Sat Jul 17 11:04:06 UTC 2004


Hi Edi,

"Edi Weitz" <edi at agharta.de> wrote:


>[Looks like it didn't work the first time with common-lisp.net - maybe due
>to my misconfiguration of SquirrelMail. I'll try it again. Note that Peter
>has already pointed out my mistaken assumption.]
>
>I'm sitting in a train and trying to send this via my cell
>phone. Let's see if it works... :)
>
>I've looked at the source code of mod_lisp.c (version 2.33) and Apache
>(1.3.29) and I'm beginning to ask myself whether the "Keep-Socket" option
>makes any sense at all. What I see with my limited knowledge of Apache is
>the following:
>
>1. The actual content handler in mod_lisp.c which is called each time
>   a new request comes in (from the client) is the function
>   lisp_handler.
>
>2. To get a socket, lisp-handler calls OpenLispSocket.
>
>3. OpenLispSocket uses ap_psocket (using the global variable
>   SocketPool) to get a socket from Apache.
>
>4. ap_psocket is defined in Apache's src/main/alloc.c and basically
>   just calls ap_psocket_ex.
>
>5. ap_socket_ex always unconditionally acquires a new socket via
>   socket(7). The pool which is its first argument (and which is
>   SocketPool from above) is only used for cleanup purposes.
>
>So, as a consequence, I cannot understand if and how the socket used by
>lisp_handler is ever going to be re-used.
>
>I'm sending a copy of this email to mod-lisp-devel because Marc is the
>authoritative source for this kind of questions... :)

Hi Edi,

in OpenLispSocket:

If there is a socket in cfg->LispSocket and that socket is not unsafe
(cfg->UnsafeLispSocket) then I return this socket. I don't create a new one.
Re-using the socket is much faster.

  if (cfg->LispSocket)
    if (cfg->UnsafeLispSocket)
      {
        ap_pclosesocket(SocketPool, cfg->LispSocket);
        cfg->LispSocket = 0;
        cfg->UnsafeLispSocket = 0;
      }
    else
       return cfg->LispSocket;

Or did I mis-read your question ?

Cheers,

Marc







More information about the mod-lisp-devel mailing list