I'm trying to serve multiple requests concurrently in Rails 4, something I was able to do very easily with config.threadsafe!
and Puma
in Rails 3.
Say I have this controller
class ConcurrentController < ApplicationController
def index
sleep 10000
end
def show
end
end
I used to be able to just start puma with puma -t 2:16 -p 3000
(for min 2 threads) and hit index
and then show
and still have show
render properly.
In Rails 4, if I attempt to do the same thing Puma now locks on the index
request and show
never gets rendered. When I hit Ctrl-C
for the server Puma gives me this error:
Rack app error: #<ThreadError: Attempt to unlock a mutex which is locked by another thread>
What am I missing here to get concurrency to work with Rails 4? config.threadsafe!
is supposed to not be needed (and doesn't make a difference even if I try)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…