Skip to content

Commit

Permalink
Fixed some problems with spawning applications that print messages wi…
Browse files Browse the repository at this point in the history
…thout newline during startup. Fixes issue #1039.
  • Loading branch information
FooBarWidget committed Jan 1, 2014
1 parent 536b02d commit 38afa8c
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 4 deletions.
2 changes: 2 additions & 0 deletions NEWS
Expand Up @@ -12,6 +12,8 @@ Release 4.0.31
all clients have disconnected. Fixes issue #884.
* Fixed compilation problems on FreeBSD.
* Fixed some C++ strict aliasing problems.
* Fixed some problems with spawning applications that print messages without
newline during startup. Fixes issue #1039.
* When Phusion Passenger is installed through the Debian package,
passenger-install-apache2-module now checks whether the Apache
module package (libapache2-mod-passenger) is properly installed,
Expand Down
2 changes: 1 addition & 1 deletion helper-scripts/classic-rails-loader.rb
Expand Up @@ -149,7 +149,7 @@ def self.rails_will_preload_app_code?
handshake_and_read_startup_request
init_passenger
handler = load_app
puts "!> Ready"
LoaderSharedHelpers.advertise_readiness
LoaderSharedHelpers.advertise_sockets(STDOUT, handler)
puts "!> "
handler.main_loop
Expand Down
2 changes: 1 addition & 1 deletion helper-scripts/classic-rails-preloader.rb
Expand Up @@ -163,7 +163,7 @@ def self.negotiate_spawn_command
exit exit_code_for_exception(e)
end

puts "!> Ready"
LoaderSharedHelpers.advertise_readiness
LoaderSharedHelpers.advertise_sockets(STDOUT, handler)
puts "!> "
return handler
Expand Down
2 changes: 1 addition & 1 deletion helper-scripts/rack-loader.rb
Expand Up @@ -98,7 +98,7 @@ def self.load_app
load_app
LoaderSharedHelpers.before_handling_requests(false, options)
handler = RequestHandler.new(STDIN, options.merge("app" => app))
puts "!> Ready"
LoaderSharedHelpers.advertise_readiness
LoaderSharedHelpers.advertise_sockets(STDOUT, handler)
puts "!> "
handler.main_loop
Expand Down
2 changes: 1 addition & 1 deletion helper-scripts/rack-preloader.rb
Expand Up @@ -137,7 +137,7 @@ def self.negotiate_spawn_command
exit exit_code_for_exception(e)
end

puts "!> Ready"
LoaderSharedHelpers.advertise_readiness
LoaderSharedHelpers.advertise_sockets(STDOUT, handler)
puts "!> "
return handler
Expand Down
9 changes: 9 additions & 0 deletions lib/phusion_passenger/loader_shared_helpers.rb
Expand Up @@ -42,6 +42,8 @@ def init
# To be called whenever the (pre)loader is about to abort with an error.
def about_to_abort(exception = nil)
dump_all_information
# https://code.google.com/p/phusion-passenger/issues/detail?id=1039
puts
end

def to_boolean(value)
Expand Down Expand Up @@ -250,6 +252,13 @@ def create_socket_address(protocol, address)
end
end

def advertise_readiness
# https://code.google.com/p/phusion-passenger/issues/detail?id=1039
puts

puts "!> Ready"
end

def advertise_sockets(output, request_handler)
request_handler.server_sockets.each_pair do |name, options|
concurrency = PhusionPassenger.advertised_concurrency_level || options[:concurrency]
Expand Down

0 comments on commit 38afa8c

Please sign in to comment.