Project

General

Profile

Bug #14142

Race condition on all? versions of rack when smart-proxy is configured with both http and https.

Added by Dmitri Dolguikh about 4 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Core
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

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.

Associated revisions

Revision e5b66974 (diff)
Added by Dominic Cleal about 4 years ago

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.

History

#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.

#2 Updated by The Foreman Bot about 4 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Dmitri Dolguikh
  • Pull request https://github.com/theforeman/smart-proxy/pull/396 added

#3 Updated by The Foreman Bot about 4 years ago

  • Pull request https://github.com/theforeman/smart-proxy/pull/397 added

#4 Updated by Dominic Cleal about 4 years ago

  • Assignee changed from Dmitri Dolguikh to Dominic Cleal
  • Pull request deleted (https://github.com/theforeman/smart-proxy/pull/396)

#5 Updated by Dominic Cleal about 4 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#6 Updated by Dominic Cleal about 4 years ago

  • Legacy Backlogs Release (now unused) set to 141

Also available in: Atom PDF