title: Start rails server in production mode local
body: <p>we have some concurrency issues, that I'd like to reproduce on my machine. On production we have a passenger instance running. To get concurrent request, I tried to start the rails app (<strong>Rails 3.2</strong>) with thin and a threaded option like this:</p>
  
  <pre><code>bundle exec thin --threaded -p 3000 --threadpool-size 50 start -e production
  </code></pre>
  
  <p>I also ran <code>RAILS_ENV=production bundle exec rake assets:precompile</code> to get everything like in production.</p>
  
  <p>However, when I access <code>localhost:3000</code> in my browser, I get part of the HTML (it displays), but then the browser runs into a timeout with <code>GET http://localhost:3000/ net::ERR_EMPTY_RESPONSE</code> and loading of the page stops.</p>
  
  <p>When I stop thin with Ctrl-C, I get the following message multiple times:</p>
  
  <pre><code>Unexpected error while processing request: Attempt to unlock a mutex which is not locked
  </code></pre>
  
  <p>Anybody an idea, why the browser gets a timeout, or how to get concurrent requests working on a local machine with thin? It would also be no problem to try another server like puma, but a whole apache / passenger installation would be too much.</p>
  
  <p><strong>Update</strong></p>
  
  <p>I tried it without the browser, and just do a <code>curl --verbose http://localhost:3000</code>. The first time, I get the HTML back:</p>
  
  <pre><code>* Rebuilt URL to: http://localhost:3000/
  *   Trying ::1...
  * connect to ::1 port 3000 failed: Connection refused
  *   Trying 127.0.0.1...
  * Connected to localhost (127.0.0.1) port 3000 (#0)
  &gt; GET / HTTP/1.1
  &gt; Host: localhost:3000
  &gt; User-Agent: curl/7.43.0
  &gt; Accept: */*
  &gt; 
  &lt; HTTP/1.1 200 OK
  &lt; Content-Type: text/html; charset=utf-8
  &lt; Content-Length: 88748
  &lt; X-UA-Compatible: IE=Edge,chrome=1
  &lt; ETag: "d16fa9f8e279774f09c2172988a6d5a6"
  &lt; Cache-Control: max-age=0, private, must-revalidate
  &lt; Set-Cookie: _session_id=c23af3cc254b66789b635edfefd4a120; path=/; HttpOnly
  &lt; X-Request-Id: 539b87c3916cf6733fc9e91a05c4f8e9
  &lt; X-Runtime: 0.488556
  &lt; Date: Mon, 07 Dec 2015 13:33:26 GMT
  &lt; X-Rack-Cache: miss
  &lt; Connection: keep-alive
  &lt; Server: thin
  &lt; 
  &lt;!DOCTYPE html&gt;
  ... (more html)
  </code></pre>
  
  <p>But the second time I run the curl command, it times out:</p>
  
  <pre><code>* Rebuilt URL to: http://localhost:3000/
  *   Trying ::1...
  * connect to ::1 port 3000 failed: Connection refused
  *   Trying 127.0.0.1...
  * Connected to localhost (127.0.0.1) port 3000 (#0)
  &gt; GET / HTTP/1.1
  &gt; Host: localhost:3000
  &gt; User-Agent: curl/7.43.0
  &gt; Accept: */*
  &gt; 
  * Empty reply from server
  * Connection #0 to host localhost left intact
  curl: (52) Empty reply from server
  </code></pre>
  
  <p>Unfortunately, no errors are written to the thin's output or <code>log/production.log</code>.</p>