I have a simple server process that works perfectly with IO::Socket::INET. It opens the server socket, waits for a new connection, accept()'s it, and then forks to handle it, while the parent process waits for more connections. Seems pretty standard to me.

Well, I needed to get this server working with SSL. My first thought, "Is there a module that basically wraps SSL around the INET module?" Yup, sure enough, IO::Socket::SSL

So, I make the modifications (which are relatively minimal). Things seem to be working... I was testing my client with the server in DEBUG mode for the SSL module. What I then noticed was that the debug output was getting larger with each connection. It seemed to be outputing info relevant to previous socket connections/contexts.

Well, after seeing that, I decided to check memory and see what was happening with that. And sure enough, memory usage for the main server process was going up with every connection. When I used the INET module it remained static.

So... is there a known memory leak when using IO::Socket::SSL with fork() for handling multiple connections? I thought it was strange that no example I could find used fork. I saw one that actually used inetd to handle the incoming connections. Does anyone know if using fork with IO::Socket::SSL is possible without memory leaks?

And BTW, I did RTFM... didn't come up with much that indicated what I want to do it a problem.

Thanks,
-Alex


In reply to IO::Socket::SSL and fork() in a server process? by Diverman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.