title: What is likely the reason that causes tornado ioloop to stall while stopping it?
body: <p>I have a tornado application that keep receiving and processing websocket messages from 10 websocket connections. The program will restart every 1 hour. I add a simple line: </p>
  
  <pre><code>ioloop.call_later(3600, ioloop.stop)
  </code></pre>
  
  <p>to make the ioloop stop.</p>
  
  <p>But what I found is that sometimes the program stalled for 4-5 minutes when it is supposed to call ioloop.stop and exit.</p>
  
  <p>I'm aware that the open websocket is not cleaned up properly when ioloop is stopped. Actually, when the program stalled, using netstat I can see that the websocket connections are still open, and recv-Q is filled with messages.</p>
  
  <p>So my question is what causes the program to stall and why? Thanks in advance.</p>