Skip to content

Instantly share code, notes, and snippets.

@cwjenkins
Created December 16, 2012 22:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cwjenkins/4313869 to your computer and use it in GitHub Desktop.
Save cwjenkins/4313869 to your computer and use it in GitHub Desktop.
Creates deadlock recursive locking on rack-1.4.1. MUST RUN IT TWICE!
require 'rubygems'
require 'thin'
require 'rack'
success = Rack::URLMap.new("/" => lambda { |env| [200, {"Content-Type" => "text/plain"}, ["bar"]] })
success_app = Rack::Builder.new {
use Rack::Lock
run success
}.to_app
error = Rack::URLMap.new("/" => lambda { |env| [404, {"Content-Type" => "text/plain"}, ["foo"]] })
error_app = Rack::Builder.new {
use Rack::Lock
run error
}.to_app
Rack::Handler::Thin.run Rack::Cascade.new([
error_app,
success_app
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment