Race condition on all? versions of rack when smart-proxy is configured with both http and https.
An issue in rack around here: https://github.com/rack/rack/blob/master/lib/rack/handler/webrick.rb#L31. A singleton-class variable is being initialized at that spot. It is possible that if more than one call to Rack::Handler::WebRick.run are made sufficiently close to each other, then @server variable is re-initialized with a value from a latter call.
fixes #14142 - launch WEBrick directly, avoiding Rack::Server
Rack::Server calls server-specific handlers such as
Rack::Handler::WEBrick which relies on a class-level variable that
causes race conditions when launching two WEBrick instances via
Rack::Server within the same process.
Launching WEBrick with the Rack::Builder-prepared app prevents the race
between the two instances, ensuring both start up correctly. The Rack
WEBrick handler is still used to interface between WEBrick and the app
built with Rack.
#1 Updated by Dominic Cleal about 4 years ago
I think I'm seeing this issue too, with the symptom being that one of the two servers doesn't get configured correctly. e.g. https_port is 8442, while http_port is 8443 for me, and occasionally I see:
I, [2016-03-17T12:19:14.251516 #20461] INFO -- : WEBrick::HTTPServer#start: pid=20461 port=8442 I, [2016-03-17T12:19:14.251690 #20461] INFO -- : WEBrick::HTTPServer#start: pid=20461 port=8442
The server doesn't respond at all on port 8443 when this happens.