<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
    <title></title>
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Le 20/04/2012 16:06, Claudiu Saftoiu a &eacute;crit&nbsp;:
    <blockquote
cite="mid:CAGJ7VxHTcmU=47E1re+CWwRzbLJAFGw31ttcSxPiGbmLmPkWGA@mail.gmail.com"
      type="cite">
      <div class="gmail_quote">
        <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
          0.8ex; border-left: 1px solid rgb(204, 204, 204);
          padding-left: 1ex;">
          <div class="gmail_quote">
            <div>Ah, so it seems that, as I leave the server running
              longer &amp; longer,</div>
            <div>more &amp; more threads are taken up with a `.recv()`
              call. I think one of</div>
            <div>my clients opens requests and does not read them/close
              them. Eventually</div>
            <div>all the threads are blocking in that fashion.&nbsp;</div>
            <div><br>
            </div>
            <div>I will fix my clients. But, is there a server-side fix
              to this (again, using Repoze.BFG)?</div>
            <div>Something to time out the connection after 60 seconds
              or so if nothing has happened?</div>
          </div>
        </blockquote>
        <div><br>
        </div>
        <div>Additional info: in particular the blocked threads' stack
          dumps look like this:</div>
        <div><br>
        </div>
        <div>
          <div>Thread 140605868680960:</div>
          <div>&nbsp; ---------- [snip]----------</div>
          <div>&nbsp; File
            "/home/tsa/env/lib/python2.6/site-packages/paste/httpserver.py",
            line 474, in read</div>
          <div>&nbsp; &nbsp; data = self.file.read(length)</div>
          <div>&nbsp; File "/usr/lib/python2.6/socket.py", line 377, in read</div>
          <div>&nbsp; &nbsp; data = self._sock.recv(left)</div>
        </div>
        <div><br>
        </div>
        <div>Was my assessment of the situation accurate?</div>
      </div>
    </blockquote>
    <br>
    I would say so, and it seems that what makes the thread hang on is
    that the socket is not closed by your clients. (otherwise recv would
    exit with an exception).<br>
    <br>
    Alex
  </body>
</html>