title: Server hangs all requests after a while
body: <p>Our Rails 4.0 application (Ruby 2.1.2) is running on Nginx with Puma 2.9.0. </p>
  
  <p>I recently noticed that all requests to our application hang after a while (usually 1 or 2 days). </p>
  
  <p>When checking the log, which is set to <code>debug</code> mode, I noticed the following log stack up:</p>
  
  <pre><code>[2014-10-11T00:02:31.727382 #23458]  INFO -- : Started GET "/" for ...
  </code></pre>
  
  <p>It does mean that requests actually hit the Rails app but somehow it isn't proceeded, while normally it would be:</p>
  
  <pre><code>I, [2014-10-11T00:02:31.727382 #23458]  INFO -- : Started GET "/" for ....
  I, [2014-10-11T00:02:31.729393 #23458]  INFO -- : Processing by HomeController#index as HTML
  </code></pre>
  
  <p>My puma config is the following:</p>
  
  <pre><code>threads 16,32
  workers 4
  </code></pre>
  
  <p>Our application is only for internal usage as now, so the RPM is very low, and none of the requests are take longer than 2s.</p>
  
  <p>What is/are the reasons that could lead to this problem? (puma config, database connection, etc.)</p>
  
  <p>Thank you in advance.</p>
  
  <p>Update:
  After installing the gem rack_timer to log the time spent on each middleware, I realized that our requests has been stuck at the ActiveRecord::QueryCache when the hang occurred, with huge amount of time on it:</p>
  
  <pre><code>Rack Timer (incoming) -- ActiveRecord::QueryCache: 925626.7731189728 ms
  </code></pre>
  
  <p>I removed this middleware for now and it seems to be back to normal. However, I understand the purpose of this middleware is to increase the performance, so removing it is just a temporary solution. Please help me find out the possible cause of this issue.</p>
  
  <p>FYI, we're using mysql (5.1.67) with adapter mysql2 (0.3.13)</p>