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.
Related issues
Bug #14142: Race condition on all? versions of rack when smart-proxy is configured with both http and https.
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.