passenger 4.0.33 → 4.0.34

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of passenger might be problematic. Click here for more details.

Files changed (112) hide show
  1. checksums.yaml +15 -0
  2. checksums.yaml.gz.asc +12 -0
  3. data.tar.gz.asc +7 -7
  4. data/NEWS +60 -0
  5. data/bin/passenger-config +1 -1
  6. data/bin/passenger-install-apache2-module +510 -40
  7. data/bin/passenger-install-nginx-module +26 -2
  8. data/build/cxx_tests.rb +1 -1
  9. data/build/documentation.rb +19 -21
  10. data/build/integration_tests.rb +39 -12
  11. data/build/misc.rb +18 -0
  12. data/build/packaging.rb +116 -56
  13. data/build/rpm.rb +20 -11
  14. data/build/ruby_tests.rb +2 -3
  15. data/build/test_basics.rb +9 -0
  16. data/debian.template/passenger.conf +2 -0
  17. data/debian.template/passenger.load +2 -0
  18. data/dev/run_travis.sh +3 -5
  19. data/dev/test_rpm_packaging.sh +28 -0
  20. data/doc/Users guide Apache.idmap.txt +6 -4
  21. data/doc/users_guide_snippets/installation.txt +20 -2
  22. data/doc/users_guide_snippets/tips.txt +1 -1
  23. data/ext/common/ApplicationPool2/Pool.h +1 -1
  24. data/ext/common/Constants.h +5 -1
  25. data/ext/common/agents/HelperAgent/RequestHandler.h +1 -1
  26. data/ext/common/agents/Watchdog/AgentWatcher.cpp +20 -0
  27. data/ext/common/agents/Watchdog/Main.cpp +10 -0
  28. data/ext/ruby/passenger_native_support.c +23 -11
  29. data/helper-scripts/classic-rails-loader.rb +9 -3
  30. data/helper-scripts/classic-rails-preloader.rb +10 -4
  31. data/helper-scripts/download_binaries/extconf.rb +46 -22
  32. data/helper-scripts/meteor-loader.rb +0 -1
  33. data/helper-scripts/node-loader.js +2 -1
  34. data/helper-scripts/prespawn +7 -1
  35. data/helper-scripts/rack-loader.rb +32 -3
  36. data/helper-scripts/rack-preloader.rb +10 -4
  37. data/lib/phusion_passenger.rb +40 -21
  38. data/lib/phusion_passenger/abstract_installer.rb +7 -4
  39. data/lib/phusion_passenger/analytics_logger.rb +4 -3
  40. data/lib/phusion_passenger/config/about_command.rb +27 -6
  41. data/lib/phusion_passenger/{config.rb → config/main.rb} +3 -2
  42. data/lib/phusion_passenger/config/restart_app_command.rb +1 -1
  43. data/lib/phusion_passenger/config/validate_install_command.rb +231 -0
  44. data/lib/phusion_passenger/constants.rb +2 -0
  45. data/lib/phusion_passenger/loader_shared_helpers.rb +92 -19
  46. data/lib/phusion_passenger/native_support.rb +33 -11
  47. data/lib/phusion_passenger/packaging.rb +1 -0
  48. data/lib/phusion_passenger/platform_info.rb +5 -2
  49. data/lib/phusion_passenger/platform_info/apache.rb +229 -60
  50. data/lib/phusion_passenger/platform_info/apache_detector.rb +26 -31
  51. data/lib/phusion_passenger/platform_info/depcheck_specs/apache2.rb +4 -4
  52. data/lib/phusion_passenger/platform_info/depcheck_specs/compiler_toolchain.rb +4 -4
  53. data/lib/phusion_passenger/platform_info/depcheck_specs/libs.rb +1 -1
  54. data/lib/phusion_passenger/platform_info/depcheck_specs/ruby.rb +1 -1
  55. data/lib/phusion_passenger/platform_info/linux.rb +2 -1
  56. data/lib/phusion_passenger/platform_info/ruby.rb +7 -0
  57. data/lib/phusion_passenger/preloader_shared_helpers.rb +2 -1
  58. data/lib/phusion_passenger/request_handler.rb +2 -1
  59. data/lib/phusion_passenger/request_handler/thread_handler.rb +2 -1
  60. data/lib/phusion_passenger/standalone/runtime_installer.rb +35 -13
  61. data/lib/phusion_passenger/standalone/start_command.rb +2 -2
  62. data/lib/phusion_passenger/utils.rb +1 -23
  63. data/lib/phusion_passenger/utils/ansi_colors.rb +7 -1
  64. data/lib/phusion_passenger/utils/download.rb +36 -2
  65. data/lib/phusion_passenger/utils/native_support_utils.rb +65 -0
  66. data/resources/templates/apache2/apache_install_broken.txt.erb +20 -0
  67. data/resources/templates/apache2/config_snippets.txt.erb +2 -4
  68. data/resources/templates/apache2/present_choice_for_no_update_config.txt.erb +5 -0
  69. data/resources/templates/installer_common/cannot_access_files_as_root.txt.erb +15 -0
  70. data/resources/templates/installer_common/run_installer_as_root.txt.erb +6 -3
  71. data/resources/templates/nginx/nginx_module_sources_not_available.txt.erb +1 -1
  72. data/resources/templates/nginx/other_nginx_installations_exist.txt.erb +17 -0
  73. data/rpm/apache-passenger.conf.in +26 -0
  74. data/rpm/config.json +30 -0
  75. data/rpm/passenger.logrotate +7 -0
  76. data/rpm/passenger.spec.template +456 -0
  77. data/rpm/passenger_dynamic_thread_group.patch +16 -0
  78. data/rpm/passenger_tests_default_config_example.patch +44 -0
  79. data/rpm/rubygem-passenger-4.0.18-GLIBC_HAVE_LONG_LONG.patch +21 -0
  80. data/rpm/rubygem-passenger-4.0.18-gcc47-include-sys_types.patch +45 -0
  81. data/test/config.json.rpm-automation +15 -0
  82. data/test/integration_tests/downloaded_binaries_tests.rb +80 -2
  83. data/test/integration_tests/native_packaging_spec.rb +136 -44
  84. data/test/integration_tests/standalone_tests.rb +2 -11
  85. data/test/ruby/analytics_logger_spec.rb +65 -19
  86. data/test/ruby/utils_spec.rb +2 -0
  87. metadata +532 -548
  88. metadata.gz.asc +7 -7
  89. data/resources/templates/apache2/no_write_permission_to_passenger_root.txt.erb +0 -9
  90. data/rpm/README.rdoc +0 -117
  91. data/rpm/config/apache-passenger.conf.in +0 -19
  92. data/rpm/config/nginx-passenger.conf.in +0 -10
  93. data/rpm/config/rubygem-passenger.te +0 -10
  94. data/rpm/doc/README.nginx-alternatives +0 -5
  95. data/rpm/doc/example_yum_repository_htaccess +0 -5
  96. data/rpm/doc/footer.shtml +0 -12
  97. data/rpm/doc/header.shtml +0 -156
  98. data/rpm/nginx-alternatives.spec +0 -97
  99. data/rpm/passenger-release.spec +0 -91
  100. data/rpm/passenger.spec +0 -667
  101. data/rpm/patches/passenger-force-native.patch +0 -63
  102. data/rpm/release/RPM-GPG-KEY-stealthymonkeys +0 -33
  103. data/rpm/release/build-release.sh +0 -35
  104. data/rpm/release/build.rb +0 -301
  105. data/rpm/release/create-mirrors.sh +0 -16
  106. data/rpm/release/mirrors +0 -1
  107. data/rpm/release/mock-repo/comps.xml +0 -21
  108. data/rpm/release/mock-repo/rubygem-daemon_controller-0.2.5-1.noarch.rpm +0 -0
  109. data/rpm/release/mock-repo/rubygem-file-tail-1.0.5-1.noarch.rpm +0 -0
  110. data/rpm/release/mock-repo/rubygem-spruz-0.2.2-1.noarch.rpm +0 -0
  111. data/rpm/release/mocksetup-first.sh +0 -102
  112. data/rpm/release/mocksetup.sh +0 -67
@@ -15,24 +15,28 @@
15
15
  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
16
 
17
17
  RPM_NAME = "passenger"
18
- RPMBUILD_ROOT = File.expand_path("~/rpmbuild")
19
18
  MOCK_OFFLINE = boolean_option('MOCK_OFFLINE', false)
20
19
  ALL_RPM_DISTROS = {
21
20
  "el6" => { :mock_chroot_name => "epel-6", :distro_name => "Enterprise Linux 6" },
22
21
  "amazon" => { :mock_chroot_name => "epel-6", :distro_name => "Amazon Linux" }
23
22
  }
24
23
 
25
- desc "Build gem for use in RPM building"
26
- task 'rpm:gem' do
27
- rpm_source_dir = "#{RPMBUILD_ROOT}/SOURCES"
28
- sh "gem build #{PACKAGE_NAME}.gemspec"
29
- sh "cp #{PACKAGE_NAME}-#{PACKAGE_VERSION}.gem #{rpm_source_dir}/"
24
+ task 'rpm:sources' => ['package:set_official', 'package:tarball'] do
25
+ basename = "#{PACKAGE_NAME}-#{VERSION_STRING}"
26
+ nginx_version = PhusionPassenger::PREFERRED_NGINX_VERSION
27
+
28
+ sh "cp #{PKG_DIR}/#{basename}.tar.gz rpm/* #{rpmbuild_root}/SOURCES/"
29
+ if File.exist?("#{rpmbuild_root}/SOURCES/nginx-#{nginx_version}.tar.gz")
30
+ puts "Local Nginx tarball already exists."
31
+ else
32
+ sh "curl -L -o #{rpmbuild_root}/SOURCES/nginx-#{nginx_version}.tar.gz http://nginx.org/download/nginx-#{nginx_version}.tar.gz"
33
+ end
30
34
  end
31
35
 
32
36
  desc "Build RPM for local machine"
33
- task 'rpm:local' => 'rpm:gem' do
37
+ task 'rpm:local' => 'rpm:sources' do
34
38
  distro_id = `./rpm/get_distro_id.py`.strip
35
- rpm_spec_dir = "#{RPMBUILD_ROOT}/SPECS"
39
+ rpm_spec_dir = "#{rpmbuild_root}/SPECS"
36
40
  spec_target_dir = "#{rpm_spec_dir}/#{distro_id}"
37
41
  spec_target_file = "#{spec_target_dir}/#{RPM_NAME}.spec"
38
42
 
@@ -50,7 +54,7 @@ task 'rpm:local:uninstall' do
50
54
  end
51
55
 
52
56
  task 'rpm:local:reinstall' => 'rpm:local:uninstall' do
53
- rpm_spec_dir = "#{RPMBUILD_ROOT}/RPMS"
57
+ rpm_spec_dir = "#{rpmbuild_root}/RPMS"
54
58
  files = []
55
59
  ["passenger", "mod_passenger", "passenger-devel", "passenger-doc", "passenger-native-libs", "passenger-debuginfo"].each do |package_name|
56
60
  files << Dir["#{rpm_spec_dir}/*/#{package_name}-#{PACKAGE_VERSION}-*.rpm"].first
@@ -65,7 +69,7 @@ end
65
69
  def create_rpm_build_task(distro_id, mock_chroot_name, distro_name)
66
70
  desc "Build RPM for #{distro_name}"
67
71
  task "rpm:#{distro_id}" => 'rpm:gem' do
68
- rpm_spec_dir = "#{RPMBUILD_ROOT}/SPECS"
72
+ rpm_spec_dir = "#{rpmbuild_root}/SPECS"
69
73
  spec_target_dir = "#{rpm_spec_dir}/#{distro_id}"
70
74
  spec_target_file = "#{spec_target_dir}/#{RPM_NAME}.spec"
71
75
  maybe_offline = MOCK_OFFLINE ? "--offline" : nil
@@ -80,7 +84,7 @@ def create_rpm_build_task(distro_id, mock_chroot_name, distro_name)
80
84
  sh "mock --verbose #{maybe_offline} " +
81
85
  "-r #{mock_chroot_name}-x86_64 " +
82
86
  "--resultdir '#{PKG_DIR}/#{distro_id}' " +
83
- "rebuild #{RPMBUILD_ROOT}/SRPMS/#{RPM_NAME}-#{PACKAGE_VERSION}-1#{distro_id}.src.rpm"
87
+ "rebuild #{rpmbuild_root}/SRPMS/#{RPM_NAME}-#{PACKAGE_VERSION}-1#{distro_id}.src.rpm"
84
88
  end
85
89
  end
86
90
 
@@ -117,3 +121,8 @@ task "rpm:publish" do
117
121
  sh "#{rsync} #{PKG_DIR}/yumgems/ #{server}:#{remote_dir}/new/"
118
122
  sh "ssh #{server} 'rm -rf #{remote_dir}/previous && mv #{remote_dir}/latest #{remote_dir}/previous && mv #{remote_dir}/new #{remote_dir}/latest'"
119
123
  end
124
+
125
+
126
+ def rpmbuild_root
127
+ @rpmbuild_root ||= File.expand_path("~/rpmbuild")
128
+ end
@@ -33,9 +33,8 @@ task 'test:ruby' => dependencies do
33
33
  require 'shellwords'
34
34
  maybe_grep = "-e #{Shellwords.escape(maybe_grep)}"
35
35
  end
36
- Dir.chdir("test") do
37
- ruby "#{PlatformInfo.rspec} -c -f s -P 'dont-autoload-anything' #{maybe_grep} ruby/*_spec.rb ruby/*/*_spec.rb"
38
- end
36
+ command = "#{PlatformInfo.rspec} -c -f s -P 'dont-autoload-anything' #{maybe_grep} ruby/*_spec.rb ruby/*/*_spec.rb"
37
+ sh "cd test && exec #{command}"
39
38
  end
40
39
  end
41
40
 
@@ -54,6 +54,15 @@ task 'test:install_deps' do
54
54
  sh "#{gem_install} bundler rspec daemon_controller json rack"
55
55
  end
56
56
  if boolean_option('DOCTOOLS', default)
57
+ begin
58
+ require 'nokogiri'
59
+ rescue LoadError
60
+ if RUBY_VERSION < '1.9'
61
+ sh "#{gem_install} nokogiri -v 1.5.9"
62
+ else
63
+ sh "#{gem_install} nokogiri"
64
+ end
65
+ end
57
66
  sh "#{gem_install} mizuho bluecloth"
58
67
  end
59
68
  if boolean_option('RAILS_BUNDLES', default)
@@ -1,4 +1,6 @@
1
+ ### Begin automatically installed Phusion Passenger config snippet ###
1
2
  <IfModule mod_passenger.c>
2
3
  PassengerRoot /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini
3
4
  PassengerDefaultRuby /usr/bin/ruby
4
5
  </IfModule>
6
+ ### End automatically installed Phusion Passenger config snippet ###
@@ -1 +1,3 @@
1
+ ### Begin automatically installed Phusion Passenger load snippet ###
1
2
  LoadModule passenger_module /usr/lib/apache2/modules/mod_passenger.so
3
+ ### End automatically installed Phusion Passenger load snippet ###
@@ -120,7 +120,8 @@ if [[ "$TEST_APACHE2" = 1 ]]; then
120
120
  run sudo apt-get install -y --no-install-recommends \
121
121
  apache2-mpm-worker apache2-threaded-dev
122
122
  install_base_test_deps
123
- run ./bin/passenger-install-apache2-module --auto
123
+ run ./bin/passenger-install-apache2-module --auto #--no-update-config
124
+ run rvmsudo ./bin/passenger-install-apache2-module --auto --no-compile
124
125
  run rake test:integration:apache2
125
126
  fi
126
127
 
@@ -137,10 +138,7 @@ if [[ "$TEST_DEBIAN_PACKAGING" = 1 ]]; then
137
138
  source-highlight
138
139
  install_test_deps_with_doctools
139
140
  run rake debian:dev debian:dev:reinstall
140
- run rake test:integration:native_packaging \
141
- LOCATIONS_INI=/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini \
142
- NATIVE_PACKAGING_METHOD=deb \
143
- SUDO=1
141
+ run rake test:integration:native_packaging SUDO=1
144
142
  run env PASSENGER_LOCATION_CONFIGURATION_FILE=/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini \
145
143
  rake test:integration:apache2 SUDO=1
146
144
  fi
@@ -0,0 +1,28 @@
1
+ #!/bin/bash
2
+ set -ex
3
+
4
+ sudo sh -c 'cat >> /etc/hosts' <<EOF
5
+ 127.0.0.1 passenger.test
6
+ 127.0.0.1 mycook.passenger.test
7
+ 127.0.0.1 zsfa.passenger.test
8
+ 127.0.0.1 norails.passenger.test
9
+ 127.0.0.1 1.passenger.test 2.passenger.test 3.passenger.test
10
+ 127.0.0.1 4.passenger.test 5.passenger.test 6.passenger.test
11
+ 127.0.0.1 7.passenger.test 8.passenger.test 9.passenger.test
12
+ EOF
13
+
14
+ # Don't care about the docs.
15
+ for F in "Users guide.html" "Users guide Apache.html" "Users guide Nginx.html" "Users guide Standalone.html" "Packaging.html" "Security of user switching support.html" "Architectural overview.html"; do
16
+ if [[ ! -f "doc/$F" ]]; then
17
+ echo > "doc/$F"
18
+ fi
19
+ done
20
+
21
+ cp test/config.json.rpm-automation test/config.json
22
+
23
+ rake test:install_deps DEVDEPS_DEFAULT=false BASE_DEPS=true RAILS_BUNDLES=true
24
+ rake rpm:local rpm:local:reinstall
25
+ rake test:integration:native_packaging SUDO=1
26
+ env PASSENGER_LOCATION_CONFIGURATION_FILE=/usr/lib/ruby/site_ruby/1.8/phusion_passenger/locations.ini \
27
+ rake test:integration:apache2 \
28
+ SUDO=1
@@ -64,13 +64,15 @@
64
64
 
65
65
  2.10.3. Forcing location of command line tools and dependencies => forcing-location-of-certain-command-line-tools-1hym30u
66
66
 
67
- 2.11. Working with the Apache configuration file => locating-the-apache-configuration-file-1fterqv
67
+ 2.11. Dealing with multiple Apache installations => dealing-with-multiple-apache-installations-ks5nkz
68
68
 
69
- 2.12. Disabling without uninstalling => unloading-disabling-phusion-passenger-from-apache-without-uninstalling-it-s1axnx
69
+ 2.12. Working with the Apache configuration file => locating-the-apache-configuration-file-1fterqv
70
70
 
71
- 2.13. Uninstalling => uninstalling-phusion-passenger-1qb4ssq
71
+ 2.13. Disabling without uninstalling => unloading-disabling-phusion-passenger-from-apache-without-uninstalling-it-s1axnx
72
72
 
73
- 2.14. Moving to a different directory => moving-to-a-different-directory-1n0gkwh
73
+ 2.14. Uninstalling => uninstalling-phusion-passenger-1qb4ssq
74
+
75
+ 2.15. Moving to a different directory => moving-to-a-different-directory-1n0gkwh
74
76
 
75
77
  3. Deploying a Ruby on Rails 1.x or 2.x (but NOT Rails >= 3.x) application => deploying-a-ruby-on-rails-1-x-or-2-x-but-not-rails-3-x-application-9r92hi
76
78
 
@@ -75,15 +75,16 @@ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
75
75
  2. Add HTTPS support for APT. Our APT repository is stored on an HTTPS server.
76
76
  +
77
77
  --------------------------------------------------------------
78
- sudo apt-get install apt-transport-https
78
+ sudo apt-get install apt-transport-https ca-certificates
79
79
  --------------------------------------------------------------
80
80
 
81
- 3. Create a file `/etc/apt/sources.list.d/passenger.list` and insert one of the following lines, depending on your distribution.
81
+ 3. Create a file `/etc/apt/sources.list.d/passenger.list` and insert **one of** the following lines, depending on your distribution.
82
82
  +
83
83
  **Open source**:::
84
84
  +
85
85
  [source,sh]
86
86
  --------------------------------------------------------------
87
+ ##### !!!! Only add ONE of these lines, not all of them !!!! #####
87
88
  # Ubuntu 13.10
88
89
  deb https://oss-binaries.phusionpassenger.com/apt/passenger saucy main
89
90
  # Ubuntu 12.04
@@ -100,6 +101,7 @@ deb https://oss-binaries.phusionpassenger.com/apt/passenger squeeze main
100
101
  +
101
102
  [source,sh]
102
103
  --------------------------------------------------------------
104
+ ##### !!!! Only add ONE of these lines, not all of them !!!! #####
103
105
  # Ubuntu 13.10
104
106
  deb https://download:YOUR_DOWNLOAD_TOKEN@www.phusionpassenger.com/enterprise_apt saucy main
105
107
  # Ubuntu 12.04
@@ -675,6 +677,7 @@ On some systems, C/C++ libraries and headers that Phusion Passenger requires may
675
677
 
676
678
  NOTE: If you run the installer with `sudo` then environment variables may not be passed properly. Learn more at <<env_vars_and_sudo,Environment variables and sudo>>.
677
679
 
680
+ [[forcing_location_of_command_line_tools_and_dependencies]]
678
681
  ==== Forcing location of command line tools and dependencies
679
682
 
680
683
  The Phusion Passenger build system attempts to autodetect many things by locating relevant helper tools. For example, to find out which compiler flags it should use for compiling Apache modules, it locates the `apxs2` command and queries it. To find out which compiler flags it should use for libcurl, it queries the `curl-config` command. These commands may not be in `$PATH`, or even when they are you may want to use a different one.
@@ -706,10 +709,25 @@ $ sudo bash
706
709
  The location of the GNU-compatible `make` tool.
707
710
 
708
711
  TIP: If you do not know what environment variables are, or how to use them, then please read <<env_vars_and_sudo,Environment variables and sudo>>.
712
+
709
713
  NOTE: If you run the installer with `sudo` then environment variables may not be passed properly. Learn more at <<env_vars_and_sudo,Environment variables and sudo>>.
710
714
 
711
715
 
712
716
  ifdef::apache[]
717
+ [[multiple_apache_installs]]
718
+ === Dealing with multiple Apache installations
719
+ Some systems have multiple Apache installations. Maybe you already know about that, and you installed multiple Apaches for a reason. Or maybe you did so in the past but then forgot about the other installs. Or maybe someone else -- or some other software -- installed another Apache for you without your knowledge.
720
+
721
+ Whatever the reason might be, it is important that you know about the existance of multiple Apache installations, and that you decide *which one* you want to use. **Unless you know exactly what you are doing, we recommend that you remove all the Apache installations that you don't intend to use, in order to avoid confusion and problems**. You should end up with only a single Apache installation. Unfortunately, this manual cannot tell you how to remove the other Apache installs: it depends on how you originally installed them. Usually it's a matter of removing the directories that they're located in, and removing their configuration files. But some Apache distributions might bundle an uninstaller. You need to do the proper research on how they ended up there in the first place.
722
+
723
+ Phusion Passenger provides a tool to check whether you have multiple Apache installations on your system. You can invoke the tool by running `passenger-config --detect-apache2`.
724
+
725
+ If the existance of multiple Apache installations is intentional, then Phusion Passenger can happily go along with your choice: you simply have to tell `passenger-install-apache2-module` which Apache to install against. There are several ways to specify which Apache you want to install against:
726
+
727
+ * By passing the `--apxs2-path` parameter. The `passenger-config --detect-apache2` command will tell you how to use this parameter.
728
+ * By setting `APXS2`, `HTTPD` and other kinds of environment variables. Please refer to <<forcing_location_of_command_line_tools_and_dependencies,Forcing location of command line tools and dependencies>> for more information.
729
+
730
+
713
731
  [[working_with_apache_conf]]
714
732
  === Working with the Apache configuration file
715
733
 
@@ -373,7 +373,7 @@ For your convenience, Phusion Passenger provides a Rack middleware for out-of-ba
373
373
  [source, ruby]
374
374
  ----------------------------------------------------
375
375
  if defined?(PhusionPassenger)
376
- require 'phusion_passenger/rack/out_of_band_gc'
376
+ PhusionPassenger.require_passenger_lib 'rack/out_of_band_gc'
377
377
 
378
378
  # Trigger out-of-band GC every 5 requests.
379
379
  use PhusionPassenger::Rack::OutOfBandGc, 5
@@ -1284,7 +1284,7 @@ public:
1284
1284
  boost::shared_ptr<DetachSuperGroupWaitTicket> ticket =
1285
1285
  boost::make_shared<DetachSuperGroupWaitTicket>();
1286
1286
  ExceptionPtr exception = copyException(
1287
- GetAbortedException("The containg SuperGroup was detached."));
1287
+ GetAbortedException("The containing SuperGroup was detached."));
1288
1288
 
1289
1289
  forceDetachSuperGroup(superGroup, actions,
1290
1290
  boost::bind(syncDetachSuperGroupCallback, _1, ticket));
@@ -42,6 +42,8 @@
42
42
 
43
43
  #define DEB_DEV_PACKAGE "passenger-dev"
44
44
 
45
+ #define DEB_MAIN_PACKAGE "passenger"
46
+
45
47
  #define DEB_NGINX_PACKAGE "nginx-extras"
46
48
 
47
49
  #define DEFAULT_ANALYTICS_LOG_GROUP ""
@@ -86,7 +88,7 @@
86
88
 
87
89
  #define NGINX_DOC_URL "http://www.modrails.com/documentation/Users%20guide%20Nginx.html"
88
90
 
89
- #define PASSENGER_VERSION "4.0.33"
91
+ #define PASSENGER_VERSION "4.0.34"
90
92
 
91
93
  #define POOL_HELPER_THREAD_STACK_SIZE 262144
92
94
 
@@ -100,6 +102,8 @@
100
102
 
101
103
  #define RPM_DEV_PACKAGE "passenger-devel"
102
104
 
105
+ #define RPM_MAIN_PACKAGE "passenger"
106
+
103
107
  #define RPM_NGINX_PACKAGE "nginx"
104
108
 
105
109
  #define SERVER_INSTANCE_DIR_GENERATION_STRUCTURE_MAJOR_VERSION 3
@@ -2203,7 +2203,7 @@ private:
2203
2203
  data.append("Connection: close\r\n");
2204
2204
 
2205
2205
  for (it = parser.begin(); it != end; it++) {
2206
- if (startsWith(it->first, "HTTP_")) {
2206
+ if (startsWith(it->first, "HTTP_") && it->first != "HTTP_CONNECTION") {
2207
2207
  string subheader = it->first.substr(sizeof("HTTP_") - 1);
2208
2208
  string::size_type i;
2209
2209
  for (i = 0; i < subheader.size(); i++) {
@@ -172,6 +172,16 @@ protected:
172
172
  */
173
173
  virtual bool processStartupInfo(pid_t pid, FileDescriptor &fd, const vector<string> &args) = 0;
174
174
 
175
+ static void killAndDontWait(pid_t pid) {
176
+ this_thread::disable_interruption di;
177
+ this_thread::disable_syscall_interruption dsi;
178
+ // If the process is a process group leader then killing the
179
+ // group will likely kill all its child processes too.
180
+ if (syscalls::killpg(pid, SIGTERM) == -1) {
181
+ syscalls::kill(pid, SIGTERM);
182
+ }
183
+ }
184
+
175
185
  /**
176
186
  * Kill a process with SIGKILL, and attempt to kill its children too.
177
187
  * Then wait until it has quit.
@@ -465,6 +475,16 @@ public:
465
475
  }
466
476
  }
467
477
 
478
+ virtual bool signalShutdown() {
479
+ boost::lock_guard<boost::mutex> l(lock);
480
+ if (pid == 0) {
481
+ return false;
482
+ } else {
483
+ killAndDontWait(pid);
484
+ return true;
485
+ }
486
+ }
487
+
468
488
  /**
469
489
  * Force the agent process to shut down. Returns true if it was shut down,
470
490
  * or false if it wasn't started.
@@ -374,6 +374,12 @@ cleanupAgentsInBackground(const WorkingObjectsPtr &wo, vector<AgentWatcherPtr> &
374
374
  } else {
375
375
  P_DEBUG("All Phusion Passenger agent processes have exited. Forcing all subprocesses to shut down.");
376
376
  }
377
+ P_DEBUG("Sending SIGTERM");
378
+ for (it = watchers.begin(); it != watchers.end(); it++) {
379
+ (*it)->signalShutdown();
380
+ }
381
+ usleep(1000000);
382
+ P_DEBUG("Sending SIGKILL");
377
383
  for (it = watchers.begin(); it != watchers.end(); it++) {
378
384
  (*it)->forceShutdown();
379
385
  }
@@ -415,6 +421,10 @@ static void
415
421
  forceAllAgentsShutdown(vector<AgentWatcherPtr> &watchers) {
416
422
  vector<AgentWatcherPtr>::iterator it;
417
423
 
424
+ for (it = watchers.begin(); it != watchers.end(); it++) {
425
+ (*it)->signalShutdown();
426
+ }
427
+ usleep(1000000);
418
428
  for (it = watchers.begin(); it != watchers.end(); it++) {
419
429
  (*it)->forceShutdown();
420
430
  }
@@ -863,7 +863,7 @@ void
863
863
  Init_passenger_native_support() {
864
864
  struct sockaddr_un addr;
865
865
 
866
- /* Only defined on Ruby >= 1.9 */
866
+ /* Only defined on Ruby >= 1.9.3 */
867
867
  #ifdef RUBY_API_VERSION_CODE
868
868
  if (ruby_api_version[0] != RUBY_API_VERSION_MAJOR
869
869
  || ruby_api_version[1] != RUBY_API_VERSION_MINOR
@@ -899,20 +899,32 @@ Init_passenger_native_support() {
899
899
  return;
900
900
  }
901
901
  #else
902
+ /* Ruby 1.8 - 1.9.2 */
903
+
904
+ /* We may not have included Ruby 1.8's version.h because of compiler
905
+ * header file search paths, so we can't rely on RUBY_VERSION being
906
+ * defined.
907
+ */
908
+ #ifdef RUBY_VERSION
909
+ #define ESTIMATED_RUBY_VERSION RUBY_VERSION
910
+ #else
911
+ #ifdef HAVE_RUBY_IO_H
912
+ #define ESTIMATED_RUBY_VERSION "1.9.1 or 1.9.2"
913
+ #else
914
+ #define ESTIMATED_RUBY_VERSION "1.8"
915
+ #endif
916
+ #endif
917
+ #ifdef HAVE_RUBY_IO_H
918
+ #define ESTIMATED_RUBY_MINOR_VERSION '9'
919
+ #else
920
+ #define ESTIMATED_RUBY_MINOR_VERSION '8'
921
+ #endif
922
+
902
923
  if (strlen(ruby_version) < sizeof("1.8.7") - 1
903
924
  || ruby_version[0] != '1'
904
925
  || ruby_version[1] != '.'
905
- || ruby_version[2] != '8')
926
+ || ruby_version[2] != ESTIMATED_RUBY_MINOR_VERSION)
906
927
  {
907
- /* We may not have included Ruby 1.8's version.h because of compiler
908
- * header file search paths, so we can't rely on RUBY_VERSION being
909
- * defined.
910
- */
911
- #ifdef RUBY_VERSION
912
- #define ESTIMATED_RUBY_VERSION RUBY_VERSION
913
- #else
914
- #define ESTIMATED_RUBY_VERSION "1.8"
915
- #endif
916
928
  fprintf(stderr, " --> passenger_native_support was compiled for Ruby %s, "
917
929
  "but you're currently running Ruby %s\n",
918
930
  ESTIMATED_RUBY_VERSION, ruby_version);
@@ -31,7 +31,12 @@ module App
31
31
  def self.format_exception(e)
32
32
  result = "#{e} (#{e.class})"
33
33
  if !e.backtrace.empty?
34
- result << "\n " << e.backtrace.join("\n ")
34
+ if e.respond_to?(:html?) && e.html?
35
+ require 'erb' if !defined?(ERB)
36
+ result << "\n<pre> " << ERB::Util.h(e.backtrace.join("\n ")) << "</pre>"
37
+ else
38
+ result << "\n " << e.backtrace.join("\n ")
39
+ end
35
40
  end
36
41
  return result
37
42
  end
@@ -65,8 +70,7 @@ module App
65
70
  PhusionPassenger.require_passenger_lib 'utils/tmpdir'
66
71
  PhusionPassenger.require_passenger_lib 'loader_shared_helpers'
67
72
  PhusionPassenger.require_passenger_lib 'request_handler'
68
- LoaderSharedHelpers.init
69
- @@options = LoaderSharedHelpers.sanitize_spawn_options(@@options)
73
+ @@options = LoaderSharedHelpers.init(@@options)
70
74
  Utils.passenger_tmpdir = options["generation_dir"]
71
75
  if defined?(NativeSupport)
72
76
  NativeSupport.disable_stdio_buffering
@@ -74,6 +78,7 @@ module App
74
78
  rescue Exception => e
75
79
  LoaderSharedHelpers.about_to_abort(e) if defined?(LoaderSharedHelpers)
76
80
  puts "!> Error"
81
+ puts "!> html: true" if e.respond_to?(:html?) && e.html?
77
82
  puts "!> "
78
83
  puts format_exception(e)
79
84
  exit exit_code_for_exception(e)
@@ -133,6 +138,7 @@ module App
133
138
  rescue Exception => e
134
139
  LoaderSharedHelpers.about_to_abort(e)
135
140
  puts "!> Error"
141
+ puts "!> html: true" if e.respond_to?(:html?) && e.html?
136
142
  puts "!> "
137
143
  puts format_exception(e)
138
144
  exit exit_code_for_exception(e)