passenger 2.2.2 → 2.2.3

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 (254) hide show
  1. data/DEVELOPERS.TXT +13 -3
  2. data/Rakefile +42 -33
  3. data/bin/passenger-install-apache2-module +1 -2
  4. data/bin/passenger-install-nginx-module +7 -19
  5. data/bin/passenger-status +64 -15
  6. data/bin/passenger-stress-test +2 -2
  7. data/doc/ApplicationPool algorithm.txt +26 -22
  8. data/doc/Users guide Apache.html +374 -149
  9. data/doc/Users guide Apache.txt +318 -51
  10. data/doc/Users guide Nginx.html +13 -13
  11. data/doc/Users guide Nginx.txt +7 -2
  12. data/doc/cxxapi/Bucket_8h-source.html +62 -25
  13. data/doc/cxxapi/Configuration_8h-source.html +343 -326
  14. data/doc/cxxapi/DirectoryMapper_8h-source.html +12 -12
  15. data/doc/cxxapi/Hooks_8h-source.html +1 -1
  16. data/doc/cxxapi/annotated.html +1 -1
  17. data/doc/cxxapi/classHooks-members.html +1 -1
  18. data/doc/cxxapi/classHooks.html +1 -1
  19. data/doc/cxxapi/classPassenger_1_1DirectoryMapper-members.html +2 -2
  20. data/doc/cxxapi/classPassenger_1_1DirectoryMapper.html +9 -9
  21. data/doc/cxxapi/classes.html +1 -1
  22. data/doc/cxxapi/definitions_8h-source.html +1 -1
  23. data/doc/cxxapi/files.html +1 -1
  24. data/doc/cxxapi/functions.html +2 -2
  25. data/doc/cxxapi/functions_func.html +2 -2
  26. data/doc/cxxapi/graph_legend.html +1 -1
  27. data/doc/cxxapi/group__Configuration.html +1 -1
  28. data/doc/cxxapi/group__Core.html +1 -1
  29. data/doc/cxxapi/group__Hooks.html +1 -1
  30. data/doc/cxxapi/group__Support.html +1 -1
  31. data/doc/cxxapi/main.html +1 -1
  32. data/doc/cxxapi/modules.html +1 -1
  33. data/doc/rdoc/classes/ConditionVariable.html +194 -0
  34. data/doc/rdoc/classes/Exception.html +120 -0
  35. data/doc/rdoc/classes/GC.html +113 -0
  36. data/doc/rdoc/classes/IO.html +169 -0
  37. data/doc/rdoc/classes/PhusionPassenger.html +238 -0
  38. data/doc/rdoc/classes/PhusionPassenger/AbstractInstaller.html +153 -0
  39. data/doc/rdoc/classes/PhusionPassenger/AbstractRequestHandler.html +517 -0
  40. data/doc/rdoc/classes/PhusionPassenger/AbstractServer.html +719 -0
  41. data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerAlreadyStarted.html +97 -0
  42. data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerError.html +96 -0
  43. data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerNotStarted.html +97 -0
  44. data/doc/rdoc/classes/PhusionPassenger/AbstractServer/UnknownMessage.html +96 -0
  45. data/doc/rdoc/classes/PhusionPassenger/AbstractServerCollection.html +598 -0
  46. data/doc/rdoc/classes/PhusionPassenger/AdminTools.html +140 -0
  47. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ControlProcess.html +317 -0
  48. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ControlProcess/Instance.html +138 -0
  49. data/doc/rdoc/classes/PhusionPassenger/AppInitError.html +154 -0
  50. data/doc/rdoc/classes/PhusionPassenger/Application.html +283 -0
  51. data/doc/rdoc/classes/PhusionPassenger/ConsoleTextTemplate.html +172 -0
  52. data/doc/rdoc/classes/PhusionPassenger/FrameworkInitError.html +145 -0
  53. data/doc/rdoc/classes/PhusionPassenger/HTMLTemplate.html +175 -0
  54. data/doc/rdoc/classes/PhusionPassenger/InitializationError.html +141 -0
  55. data/doc/rdoc/classes/PhusionPassenger/InvalidPath.html +92 -0
  56. data/doc/rdoc/classes/PhusionPassenger/MessageChannel.html +489 -0
  57. data/doc/rdoc/classes/PhusionPassenger/NativeSupport.html +350 -0
  58. data/doc/rdoc/classes/PhusionPassenger/Rack.html +91 -0
  59. data/doc/rdoc/classes/PhusionPassenger/Rack/ApplicationSpawner.html +188 -0
  60. data/doc/rdoc/classes/PhusionPassenger/Rack/RequestHandler.html +194 -0
  61. data/doc/rdoc/classes/PhusionPassenger/Railz.html +95 -0
  62. data/doc/rdoc/classes/PhusionPassenger/Railz/ApplicationSpawner.html +442 -0
  63. data/doc/rdoc/classes/PhusionPassenger/Railz/ApplicationSpawner/Error.html +98 -0
  64. data/doc/rdoc/classes/PhusionPassenger/Railz/CGIFixed.html +200 -0
  65. data/doc/rdoc/classes/PhusionPassenger/Railz/FrameworkSpawner.html +436 -0
  66. data/doc/rdoc/classes/PhusionPassenger/Railz/FrameworkSpawner/Error.html +98 -0
  67. data/doc/rdoc/classes/PhusionPassenger/Railz/RequestHandler.html +155 -0
  68. data/doc/rdoc/classes/PhusionPassenger/SpawnManager.html +402 -0
  69. data/doc/rdoc/classes/PhusionPassenger/UnknownError.html +125 -0
  70. data/doc/rdoc/classes/PhusionPassenger/Utils.html +805 -0
  71. data/doc/rdoc/classes/PhusionPassenger/VersionNotFound.html +140 -0
  72. data/doc/rdoc/classes/PhusionPassenger/WSGI.html +89 -0
  73. data/doc/rdoc/classes/PhusionPassenger/WSGI/ApplicationSpawner.html +188 -0
  74. data/doc/rdoc/classes/PlatformInfo.html +831 -0
  75. data/doc/rdoc/classes/RakeExtensions.html +197 -0
  76. data/doc/rdoc/classes/Signal.html +131 -0
  77. data/doc/rdoc/created.rid +1 -0
  78. data/doc/rdoc/files/DEVELOPERS_TXT.html +255 -0
  79. data/doc/rdoc/files/README.html +157 -0
  80. data/doc/rdoc/files/ext/phusion_passenger/native_support_c.html +92 -0
  81. data/doc/rdoc/files/lib/phusion_passenger/abstract_installer_rb.html +129 -0
  82. data/doc/rdoc/files/lib/phusion_passenger/abstract_request_handler_rb.html +131 -0
  83. data/doc/rdoc/files/lib/phusion_passenger/abstract_server_collection_rb.html +126 -0
  84. data/doc/rdoc/files/lib/phusion_passenger/abstract_server_rb.html +130 -0
  85. data/doc/rdoc/files/lib/phusion_passenger/admin_tools/control_process_rb.html +130 -0
  86. data/doc/rdoc/files/lib/phusion_passenger/admin_tools_rb.html +122 -0
  87. data/doc/rdoc/files/lib/phusion_passenger/application_rb.html +127 -0
  88. data/doc/rdoc/files/lib/phusion_passenger/console_text_template_rb.html +126 -0
  89. data/doc/rdoc/files/lib/phusion_passenger/constants_rb.html +122 -0
  90. data/doc/rdoc/files/lib/phusion_passenger/dependencies_rb.html +134 -0
  91. data/doc/rdoc/files/lib/phusion_passenger/events_rb.html +122 -0
  92. data/doc/rdoc/files/lib/phusion_passenger/exceptions_rb.html +122 -0
  93. data/doc/rdoc/files/lib/phusion_passenger/html_template_rb.html +126 -0
  94. data/doc/rdoc/files/lib/phusion_passenger/message_channel_rb.html +122 -0
  95. data/doc/rdoc/files/lib/phusion_passenger/packaging_rb.html +122 -0
  96. data/doc/rdoc/files/lib/phusion_passenger/platform_info_rb.html +127 -0
  97. data/doc/rdoc/files/lib/phusion_passenger/rack/application_spawner_rb.html +133 -0
  98. data/doc/rdoc/files/lib/phusion_passenger/rack/request_handler_rb.html +127 -0
  99. data/doc/rdoc/files/lib/phusion_passenger/railz/application_spawner_rb.html +143 -0
  100. data/doc/rdoc/files/lib/phusion_passenger/railz/cgi_fixed_rb.html +126 -0
  101. data/doc/rdoc/files/lib/phusion_passenger/railz/framework_spawner_rb.html +145 -0
  102. data/doc/rdoc/files/lib/phusion_passenger/railz/request_handler_rb.html +127 -0
  103. data/doc/rdoc/files/lib/phusion_passenger/simple_benchmarking_rb.html +122 -0
  104. data/doc/rdoc/files/lib/phusion_passenger/spawn_manager_rb.html +161 -0
  105. data/doc/rdoc/files/lib/phusion_passenger/utils_rb.html +175 -0
  106. data/doc/rdoc/files/lib/phusion_passenger/wsgi/application_spawner_rb.html +129 -0
  107. data/doc/rdoc/files/misc/rake/extensions_rb.html +130 -0
  108. data/doc/rdoc/fr_class_index.html +90 -0
  109. data/doc/rdoc/fr_file_index.html +76 -0
  110. data/doc/rdoc/fr_method_index.html +200 -0
  111. data/doc/rdoc/index.html +26 -0
  112. data/doc/rdoc/rdoc-style.css +187 -0
  113. data/doc/users_guide_snippets/rackup_specifications.txt +2 -8
  114. data/ext/apache2/Bucket.cpp +71 -38
  115. data/ext/apache2/Bucket.h +53 -16
  116. data/ext/apache2/Configuration.cpp +15 -0
  117. data/ext/apache2/Configuration.h +19 -2
  118. data/ext/apache2/DirectoryMapper.h +10 -10
  119. data/ext/apache2/Hooks.cpp +334 -74
  120. data/ext/boost/mpl/apply.hpp +5 -1
  121. data/ext/boost/mpl/apply_wrap.hpp +5 -2
  122. data/ext/boost/mpl/aux_/full_lambda.hpp +5 -1
  123. data/ext/boost/mpl/bind.hpp +5 -1
  124. data/ext/common/Application.h +11 -31
  125. data/ext/common/ApplicationPool.h +2 -1
  126. data/ext/common/ApplicationPoolServer.h +61 -20
  127. data/ext/common/ApplicationPoolServerExecutable.cpp +132 -4
  128. data/ext/common/ApplicationPoolStatusReporter.h +189 -65
  129. data/ext/common/Base64.cpp +143 -0
  130. data/ext/common/Base64.h +57 -0
  131. data/ext/common/CachedFileStat.cpp +25 -82
  132. data/ext/common/CachedFileStat.h +11 -125
  133. data/ext/common/CachedFileStat.hpp +243 -0
  134. data/ext/common/Exceptions.h +13 -0
  135. data/ext/common/FileChangeChecker.h +209 -0
  136. data/ext/common/Logging.h +3 -2
  137. data/ext/common/MessageChannel.h +10 -10
  138. data/ext/common/PoolOptions.h +72 -5
  139. data/ext/common/SpawnManager.h +11 -8
  140. data/ext/common/StandardApplicationPool.h +38 -39
  141. data/ext/common/StaticString.h +1 -0
  142. data/ext/common/StringListCreator.h +83 -0
  143. data/ext/common/SystemTime.h +3 -2
  144. data/ext/common/Timer.h +88 -0
  145. data/ext/common/Utils.cpp +161 -42
  146. data/ext/common/Utils.h +62 -31
  147. data/ext/common/Version.h +1 -1
  148. data/ext/nginx/Configuration.c +0 -4
  149. data/ext/nginx/ContentHandler.c +8 -6
  150. data/ext/nginx/HelperServer.cpp +45 -55
  151. data/ext/nginx/HttpStatusExtractor.h +4 -0
  152. data/ext/nginx/StaticContentHandler.c +25 -5
  153. data/ext/nginx/config +3 -0
  154. data/ext/nginx/ngx_http_passenger_module.c +72 -17
  155. data/ext/nginx/ngx_http_passenger_module.h +2 -2
  156. data/lib/phusion_passenger/abstract_request_handler.rb +15 -7
  157. data/lib/phusion_passenger/abstract_server.rb +16 -2
  158. data/lib/phusion_passenger/admin_tools/control_process.rb +36 -25
  159. data/lib/phusion_passenger/constants.rb +1 -1
  160. data/lib/phusion_passenger/dependencies.rb +10 -0
  161. data/lib/phusion_passenger/platform_info.rb +1 -1
  162. data/lib/phusion_passenger/rack/application_spawner.rb +21 -2
  163. data/lib/phusion_passenger/rack/request_handler.rb +10 -0
  164. data/lib/phusion_passenger/railz/application_spawner.rb +38 -2
  165. data/lib/phusion_passenger/railz/framework_spawner.rb +26 -28
  166. data/lib/phusion_passenger/railz/request_handler.rb +5 -1
  167. data/lib/phusion_passenger/spawn_manager.rb +6 -2
  168. data/lib/phusion_passenger/utils.rb +79 -27
  169. data/misc/rake/cplusplus.rb +5 -5
  170. data/test/ApplicationPoolServerTest.cpp +42 -0
  171. data/test/ApplicationPoolTest.cpp +255 -267
  172. data/test/Base64Test.cpp +48 -0
  173. data/test/CachedFileStatTest.cpp +243 -103
  174. data/test/FileChangeCheckerTest.cpp +331 -0
  175. data/test/PoolOptionsTest.cpp +80 -0
  176. data/test/UtilsTest.cpp +5 -17
  177. data/test/integration_tests/apache2_tests.rb +15 -4
  178. data/test/integration_tests/mycook_spec.rb +3 -4
  179. data/test/oxt/syscall_interruption_test.cpp +2 -14
  180. data/test/ruby/abstract_server_collection_spec.rb +1 -1
  181. data/test/ruby/abstract_server_spec.rb +35 -1
  182. data/test/ruby/rack/application_spawner_spec.rb +23 -6
  183. data/test/ruby/rails/application_spawner_spec.rb +6 -6
  184. data/test/ruby/rails/framework_spawner_spec.rb +6 -5
  185. data/test/ruby/rails/minimal_spawner_spec.rb +19 -0
  186. data/test/ruby/rails/spawner_error_handling_spec.rb +62 -7
  187. data/test/ruby/spawn_manager_spec.rb +10 -7
  188. data/test/ruby/spawn_server_spec.rb +1 -1
  189. data/test/ruby/utils_spec.rb +193 -20
  190. data/test/ruby/wsgi/application_spawner_spec.rb +3 -1
  191. data/test/stub/apache2/httpd.conf.erb +3 -0
  192. data/test/stub/rack/config.ru +1 -1
  193. data/test/stub/rails_apps/mycook/app/controllers/welcome_controller.rb +8 -0
  194. data/test/support/Support.cpp +84 -0
  195. data/test/support/Support.h +66 -8
  196. data/test/support/config.rb +14 -2
  197. data/test/support/test_helper.rb +5 -0
  198. data/vendor/rack-1.0.0-git/lib/rack/auth/openid.rb +123 -116
  199. data/vendor/rack-1.0.0-git/lib/rack/cascade.rb +17 -12
  200. data/vendor/rack-1.0.0-git/lib/rack/commonlogger.rb +34 -43
  201. data/vendor/rack-1.0.0-git/lib/rack/handler/cgi.rb +1 -1
  202. data/vendor/rack-1.0.0-git/lib/rack/handler/fastcgi.rb +1 -1
  203. data/vendor/rack-1.0.0-git/lib/rack/handler/lsws.rb +1 -1
  204. data/vendor/rack-1.0.0-git/lib/rack/handler/mongrel.rb +1 -1
  205. data/vendor/rack-1.0.0-git/lib/rack/handler/scgi.rb +1 -1
  206. data/vendor/rack-1.0.0-git/lib/rack/handler/webrick.rb +1 -1
  207. data/vendor/rack-1.0.0-git/lib/rack/mock.rb +4 -17
  208. data/vendor/rack-1.0.0-git/lib/rack/request.rb +3 -9
  209. data/vendor/rack-1.0.0-git/lib/rack/rewindable_input.rb +2 -0
  210. data/vendor/rack-1.0.0-git/lib/rack/utils.rb +38 -12
  211. metadata +231 -186
  212. data/ext/common/FileChecker.h +0 -112
  213. data/test/FileCheckerTest.cpp +0 -79
  214. data/test/stub/minimal-railsapp/README +0 -3
  215. data/test/stub/minimal-railsapp/config/application.rb +0 -0
  216. data/test/stub/minimal-railsapp/config/environment.rb +0 -3
  217. data/test/stub/minimal-railsapp/vendor/rails/actionmailer/lib/action_mailer.rb +0 -0
  218. data/test/stub/minimal-railsapp/vendor/rails/actionpack/lib/action_controller.rb +0 -10
  219. data/test/stub/minimal-railsapp/vendor/rails/actionpack/lib/action_pack.rb +0 -0
  220. data/test/stub/minimal-railsapp/vendor/rails/actionpack/lib/action_view.rb +0 -0
  221. data/test/stub/minimal-railsapp/vendor/rails/activerecord/lib/active_record.rb +0 -7
  222. data/test/stub/minimal-railsapp/vendor/rails/activeresource/lib/active_resource.rb +0 -0
  223. data/test/stub/minimal-railsapp/vendor/rails/activesupport/lib/active_support.rb +0 -17
  224. data/test/stub/minimal-railsapp/vendor/rails/activesupport/lib/active_support/whiny_nil.rb +0 -0
  225. data/test/stub/minimal-railsapp/vendor/rails/railties/lib/dispatcher.rb +0 -0
  226. data/test/stub/minimal-railsapp/vendor/rails/railties/lib/initializer.rb +0 -8
  227. data/test/stub/minimal-railsapp/vendor/rails/railties/lib/ruby_version_check.rb +0 -1
  228. data/test/stub/railsapp/app/controllers/application.rb +0 -12
  229. data/test/stub/railsapp/app/controllers/bar_controller.rb +0 -5
  230. data/test/stub/railsapp/app/controllers/bar_controller_1.txt +0 -5
  231. data/test/stub/railsapp/app/controllers/bar_controller_2.txt +0 -5
  232. data/test/stub/railsapp/app/controllers/foo_controller.rb +0 -9
  233. data/test/stub/railsapp/app/helpers/application_helper.rb +0 -3
  234. data/test/stub/railsapp/config/boot.rb +0 -108
  235. data/test/stub/railsapp/config/database.yml +0 -19
  236. data/test/stub/railsapp/config/environment.rb +0 -59
  237. data/test/stub/railsapp/config/environments/development.rb +0 -18
  238. data/test/stub/railsapp/config/environments/production.rb +0 -19
  239. data/test/stub/railsapp/config/initializers/inflections.rb +0 -10
  240. data/test/stub/railsapp/config/initializers/mime_types.rb +0 -5
  241. data/test/stub/railsapp/config/routes.rb +0 -35
  242. data/test/stub/railsapp/public/useless.txt +0 -1
  243. data/test/stub/railsapp2/app/controllers/application.rb +0 -12
  244. data/test/stub/railsapp2/app/controllers/foo_controller.rb +0 -5
  245. data/test/stub/railsapp2/app/helpers/application_helper.rb +0 -3
  246. data/test/stub/railsapp2/config/boot.rb +0 -108
  247. data/test/stub/railsapp2/config/database.yml +0 -19
  248. data/test/stub/railsapp2/config/environment.rb +0 -59
  249. data/test/stub/railsapp2/config/environments/development.rb +0 -18
  250. data/test/stub/railsapp2/config/environments/production.rb +0 -19
  251. data/test/stub/railsapp2/config/initializers/inflections.rb +0 -10
  252. data/test/stub/railsapp2/config/initializers/mime_types.rb +0 -5
  253. data/test/stub/railsapp2/config/routes.rb +0 -35
  254. data/test/stub/railsapp2/public/useless.txt +0 -1
data/DEVELOPERS.TXT CHANGED
@@ -34,7 +34,11 @@ The most important directories are:
34
34
  [ ext/phusion_passenger ]
35
35
  Native extensions for Ruby, used by the spawn server.
36
36
  [ ext/apache2 ]
37
- The Phusion Passenger Apache 2 module (mod_passenger).
37
+ Apache 2-specific source code.
38
+ [ ext/nginx ]
39
+ Nginx-specific source code.
40
+ [ ext/common ]
41
+ Source code shared by the Apache and Nginx modules.
38
42
  [ bin ]
39
43
  Executables.
40
44
  [ doc ]
@@ -47,8 +51,6 @@ The most important directories are:
47
51
  Stub code, used in the tests.
48
52
 
49
53
  Less important directories:
50
- [ lib/rake ]
51
- Rake tasks.
52
54
  [ ext/boost ]
53
55
  A stripped-down and customized version of the Boost C++ library
54
56
  (www.boost.org).
@@ -59,8 +61,16 @@ Less important directories:
59
61
  for C++. Boost was modified to make use of the functionality provided by OXT.
60
62
  [ benchmark ]
61
63
  Benchmark tools.
64
+ [ debian ]
65
+ Debian packaging files.
66
+ [ man ]
67
+ Man pages.
62
68
  [ misc ]
63
69
  Miscellaneous tools.
70
+ [ misc/rake ]
71
+ Rake tasks.
72
+ [ vendor ]
73
+ Various vendored libraries.
64
74
 
65
75
  == Tests
66
76
 
data/Rakefile CHANGED
@@ -36,6 +36,7 @@ OPTIMIZE = ["yes", "on", "true"].include?(ENV['OPTIMIZE'])
36
36
 
37
37
  include PlatformInfo
38
38
 
39
+ CC = "gcc"
39
40
  CXX = "g++"
40
41
  LIBEXT = PlatformInfo.library_extension
41
42
  if OPTIMIZE
@@ -45,11 +46,11 @@ else
45
46
  end
46
47
 
47
48
  # Extra compiler flags that should always be passed to the C/C++ compiler.
48
- # Should be included last in the command string.
49
+ # Should be included last in the command string, even after PlatformInfo.portability_cflags.
49
50
  EXTRA_CXXFLAGS = "-Wall #{OPTIMIZATION_FLAGS}"
50
51
 
51
52
  # Extra linker flags that should always be passed to the linker.
52
- # Should be included last in the command string.
53
+ # Should be included last in the command string, even after PlatformInfo.portability_ldflags.
53
54
  EXTRA_LDFLAGS = ""
54
55
 
55
56
 
@@ -150,7 +151,7 @@ def define_common_library_task(output_dir, extra_compiler_flags = nil,
150
151
  with_application_pool_server_exe = false,
151
152
  boost_oxt_library = nil,
152
153
  extra_compiler_flags_for_server_exe = nil,
153
- extra_linker_flags = nil)
154
+ extra_linker_flags_for_server_exe = nil)
154
155
  static_library = "#{output_dir}/libpassenger_common.a"
155
156
  objects_output_dir = "#{output_dir}/libpassenger_common"
156
157
  targets = [static_library]
@@ -159,7 +160,8 @@ def define_common_library_task(output_dir, extra_compiler_flags = nil,
159
160
  flags = "-Iext -Iext/common #{extra_compiler_flags} "
160
161
  flags << "#{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS}"
161
162
  common_object_files = []
162
- ['Utils.cpp', 'Logging.cpp', 'SystemTime.cpp', 'CachedFileStat.cpp'].each do |source_file|
163
+ ['Utils.cpp', 'Logging.cpp', 'SystemTime.cpp', 'CachedFileStat.cpp',
164
+ 'Base64.cpp'].each do |source_file|
163
165
  object_name = source_file.sub(/\.cpp$/, '.o')
164
166
  object_file = "#{objects_output_dir}/#{object_name}"
165
167
  header_file = source_file.sub(/\.cpp$/, '.h')
@@ -185,12 +187,14 @@ def define_common_library_task(output_dir, extra_compiler_flags = nil,
185
187
  'ext/common/ApplicationPool.h',
186
188
  'ext/common/Application.h',
187
189
  'ext/common/StandardApplicationPool.h',
190
+ 'ext/common/ApplicationPoolStatusReporter.h',
188
191
  'ext/common/MessageChannel.h',
189
192
  'ext/common/SpawnManager.h',
190
193
  'ext/common/PoolOptions.h',
191
- 'ext/common/FileChecker.h',
194
+ 'ext/common/StringListCreator.h',
195
+ 'ext/common/FileChangeChecker.h',
192
196
  'ext/common/SystemTime.h',
193
- 'ext/common/CachedFileStat.h',
197
+ 'ext/common/CachedFileStat.hpp',
194
198
  boost_oxt_library,
195
199
  static_library
196
200
  ]) do
@@ -203,7 +207,7 @@ def define_common_library_task(output_dir, extra_compiler_flags = nil,
203
207
  "#{EXTRA_CXXFLAGS} " <<
204
208
  "#{static_library} " <<
205
209
  "#{boost_oxt_library} " <<
206
- "#{extra_linker_flags} " <<
210
+ "#{extra_linker_flags_for_server_exe} " <<
207
211
  "#{PlatformInfo.portability_ldflags} " <<
208
212
  EXTRA_LDFLAGS
209
213
  )
@@ -242,7 +246,9 @@ end
242
246
  ext/common/Application.h
243
247
  ext/common/MessageChannel.h
244
248
  ext/common/PoolOptions.h
249
+ ext/common/StringListCreator.h
245
250
  ext/common/Version.h
251
+ ext/common/Timer.h
246
252
  ext/common/Utils.h)
247
253
  }
248
254
  APACHE2_OBJECTS = APACHE2_INPUT_FILES.keys
@@ -253,8 +259,7 @@ end
253
259
  PlatformInfo.apache2_module_cflags)
254
260
  APACHE2_COMMON_LIBRARY = define_common_library_task("ext/apache2",
255
261
  PlatformInfo.apache2_module_cflags,
256
- true, APACHE2_BOOST_OXT_LIBRARY, nil,
257
- PlatformInfo.apache2_module_ldflags)
262
+ true, APACHE2_BOOST_OXT_LIBRARY)
258
263
 
259
264
 
260
265
  desc "Build Apache 2 module"
@@ -382,6 +387,9 @@ end
382
387
  TEST_CXX_OBJECTS = {
383
388
  'test/CxxTestMain.o' => %w(
384
389
  test/CxxTestMain.cpp),
390
+ 'test/support/Support.o' => %w(
391
+ test/support/Support.cpp
392
+ test/support/Support.h),
385
393
  'test/MessageChannelTest.o' => %w(
386
394
  test/MessageChannelTest.cpp
387
395
  ext/common/MessageChannel.h),
@@ -389,12 +397,14 @@ end
389
397
  test/SpawnManagerTest.cpp
390
398
  ext/common/SpawnManager.h
391
399
  ext/common/PoolOptions.h
400
+ ext/common/StringListCreator.h
392
401
  ext/common/Application.h
393
402
  ext/common/MessageChannel.h),
394
403
  'test/ApplicationPoolServerTest.o' => %w(
395
404
  test/ApplicationPoolServerTest.cpp
396
405
  ext/common/ApplicationPoolServer.h
397
406
  ext/common/PoolOptions.h
407
+ ext/common/StringListCreator.h
398
408
  ext/common/MessageChannel.h),
399
409
  'test/ApplicationPoolServer_ApplicationPoolTest.o' => %w(
400
410
  test/ApplicationPoolServer_ApplicationPoolTest.cpp
@@ -403,6 +413,7 @@ end
403
413
  ext/common/ApplicationPool.h
404
414
  ext/common/SpawnManager.h
405
415
  ext/common/PoolOptions.h
416
+ ext/common/StringListCreator.h
406
417
  ext/common/Application.h
407
418
  ext/common/MessageChannel.h),
408
419
  'test/StandardApplicationPoolTest.o' => %w(
@@ -412,14 +423,21 @@ end
412
423
  ext/common/StandardApplicationPool.h
413
424
  ext/common/SpawnManager.h
414
425
  ext/common/PoolOptions.h
415
- ext/common/FileChecker.h
426
+ ext/common/StringListCreator.h
427
+ ext/common/FileChangeChecker.h
428
+ ext/common/CachedFileStat.hpp
416
429
  ext/common/Application.h),
417
430
  'test/PoolOptionsTest.o' => %w(
418
431
  test/PoolOptionsTest.cpp
419
- ext/common/PoolOptions.h),
420
- 'test/StaticString.o' => %w(
432
+ ext/common/PoolOptions.h
433
+ ext/common/StringListCreator.h),
434
+ 'test/StaticStringTest.o' => %w(
421
435
  test/StaticStringTest.cpp
422
436
  ext/common/StaticString.h),
437
+ 'test/Base64Test.o' => %w(
438
+ test/Base64Test.cpp
439
+ ext/common/Base64.h
440
+ ext/common/Base64.cpp),
423
441
  'test/ScgiRequestParserTest.o' => %w(
424
442
  test/ScgiRequestParserTest.cpp
425
443
  ext/nginx/ScgiRequestParser.h
@@ -427,17 +445,17 @@ end
427
445
  'test/HttpStatusExtractorTest.o' => %w(
428
446
  test/HttpStatusExtractorTest.cpp
429
447
  ext/nginx/HttpStatusExtractor.h),
430
- 'test/FileCheckerTest.o' => %w(
431
- test/FileCheckerTest.cpp
432
- ext/common/FileChecker.h
433
- ext/common/CachedFileStat.h),
448
+ 'test/FileChangeCheckerTest.o' => %w(
449
+ test/FileChangeCheckerTest.cpp
450
+ ext/common/FileChangeChecker.h
451
+ ext/common/CachedFileStat.hpp),
434
452
  'test/SystemTimeTest.o' => %w(
435
453
  test/SystemTimeTest.cpp
436
454
  ext/common/SystemTime.h
437
455
  ext/common/SystemTime.cpp),
438
456
  'test/CachedFileStatTest.o' => %w(
439
457
  test/CachedFileStatTest.cpp
440
- ext/common/CachedFileStat.h
458
+ ext/common/CachedFileStat.hpp
441
459
  ext/common/CachedFileStat.cpp),
442
460
  'test/UtilsTest.o' => %w(
443
461
  test/UtilsTest.cpp
@@ -518,7 +536,7 @@ end
518
536
  end
519
537
 
520
538
  TEST_OXT_OBJECTS.each_pair do |target, sources|
521
- file "test/oxt/#{target}" => sources.map{ |x| "test/oxt/#{x}" } do
539
+ file "test/oxt/#{target}" => sources.map{ |x| "test/oxt/#{x}" } + ['test/support/Support.h'] do
522
540
  Dir.chdir('test/oxt') do
523
541
  puts "### In test/oxt:"
524
542
  compile_cxx sources[0], TEST_OXT_CFLAGS
@@ -668,7 +686,7 @@ spec = Gem::Specification.new do |s|
668
686
  'doc/*/*/*/*/*/*',
669
687
  'man/*',
670
688
  'debian/*',
671
- 'ext/common/*.{cpp,c,h}',
689
+ 'ext/common/*.{cpp,c,h,hpp}',
672
690
  'ext/apache2/*.{cpp,h,c,TXT}',
673
691
  'ext/nginx/*.{c,cpp,h}',
674
692
  'ext/nginx/config',
@@ -683,21 +701,12 @@ spec = Gem::Specification.new do |s|
683
701
  'misc/*/*',
684
702
  'vendor/**/*',
685
703
  'test/*.{rb,cpp,example}',
686
- 'test/support/*',
704
+ 'test/support/*.{cpp,h,rb}',
687
705
  'test/oxt/*.cpp',
688
- 'test/ruby/*',
689
- 'test/ruby/*/*',
690
- 'test/integration_tests/*',
691
- 'test/stub/*',
692
- 'test/stub/*/*',
693
- 'test/stub/*/*/*',
694
- 'test/stub/*/*/*/*',
695
- 'test/stub/*/*/*/*/*',
696
- 'test/stub/*/*/*/*/*/*',
697
- 'test/stub/*/*/*/*/*/*/*'
698
- ] - Dir['test/stub/*/log/*'] \
699
- - Dir['test/stub/*/tmp/*/*'] \
700
- - Dir['test/stub/apache2/*.{pid,lock,log}']
706
+ 'test/ruby/**/*',
707
+ 'test/integration_tests/**/*',
708
+ 'test/stub/**/*'
709
+ ]
701
710
  s.executables = [
702
711
  'passenger-spawn-server',
703
712
  'passenger-install-apache2-module',
@@ -49,8 +49,7 @@ class Installer < PhusionPassenger::AbstractInstaller
49
49
  Dependencies::RubyGems,
50
50
  Dependencies::Rake,
51
51
  Dependencies::Apache2,
52
- Dependencies::Apache2_DevHeaders,
53
- Dependencies::FastThread
52
+ Dependencies::Apache2_DevHeaders
54
53
  ]
55
54
  if Dependencies.fastthread_required?
56
55
  result << Dependencies::FastThread
@@ -36,18 +36,21 @@ include PlatformInfo
36
36
  class Installer < PhusionPassenger::AbstractInstaller
37
37
  include PhusionPassenger
38
38
 
39
- NGINX_VERSION = "0.6.36"
39
+ NGINX_VERSION = "0.6.37"
40
40
 
41
41
  def dependencies
42
- return [
42
+ result = [
43
43
  Dependencies::GCC,
44
44
  Dependencies::Ruby_DevHeaders,
45
45
  Dependencies::Ruby_OpenSSL,
46
46
  Dependencies::RubyGems,
47
47
  Dependencies::Rake,
48
- Dependencies::FastThread,
49
48
  Dependencies::Zlib_Dev
50
49
  ]
50
+ if Dependencies.fastthread_required?
51
+ result << Dependencies::FastThread
52
+ end
53
+ return result
51
54
  end
52
55
 
53
56
  def users_guide
@@ -59,7 +62,7 @@ class Installer < PhusionPassenger::AbstractInstaller
59
62
  show_welcome_screen
60
63
  check_dependencies || exit(1)
61
64
 
62
- check_write_permission_to_passenger_root || exit(1)
65
+ check_whether_we_can_write_to(PASSENGER_ROOT) || exit(1)
63
66
 
64
67
  download_and_install = should_we_download_and_install_nginx_automatically?
65
68
  if pcre_is_installed?
@@ -102,21 +105,6 @@ private
102
105
  wait
103
106
  end
104
107
 
105
- def check_write_permission_to_passenger_root
106
- File.new("__test__.txt", "w").close
107
- return true
108
- rescue
109
- new_screen
110
- if Process.uid == 0
111
- render_template 'no_write_permission_to_passenger_root'
112
- else
113
- render_template 'run_installer_as_root'
114
- end
115
- return false
116
- ensure
117
- File.unlink("__test__.txt") rescue nil
118
- end
119
-
120
108
  def compile_passenger_support_files
121
109
  new_screen
122
110
  color_puts "<banner>Compiling Passenger support files...</banner>"
data/bin/passenger-status CHANGED
@@ -22,9 +22,10 @@
22
22
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
23
  # THE SOFTWARE.
24
24
 
25
- $LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/../lib")
26
- $LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/../ext")
25
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
26
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../ext"))
27
27
  require 'phusion_passenger/admin_tools/control_process'
28
+ require 'optparse'
28
29
 
29
30
  include PhusionPassenger::AdminTools
30
31
 
@@ -32,30 +33,78 @@ include PhusionPassenger::AdminTools
32
33
  RESET = "\e[0m"
33
34
  BOLD = "\e[1m"
34
35
  YELLOW = "\e[33m"
36
+ BLACK_BG = "\e[40m"
35
37
  BLUE_BG = "\e[44m"
36
38
 
37
- def show_status(control_process, format = :text)
38
- begin
39
- text = control_process.status
40
- rescue SystemCallError => e
41
- STDERR.puts "*** ERROR: Cannot query status for Passenger instance #{control_process.pid}:"
42
- STDERR.puts e.to_s
43
- exit 2
39
+ def show_status(control_process, options = {})
40
+ case options[:show]
41
+ when 'pool'
42
+ begin
43
+ text = control_process.status
44
+ rescue SystemCallError => e
45
+ STDERR.puts "*** ERROR: Cannot query status for Passenger instance #{control_process.pid}:"
46
+ STDERR.puts e.to_s
47
+ exit 2
48
+ end
49
+
50
+ # Colorize output
51
+ text.gsub!(/^(----)(.*)$/, YELLOW + BLUE_BG + BOLD + '\1\2' + RESET)
52
+
53
+ puts text
54
+
55
+ when 'backtraces'
56
+ begin
57
+ text = control_process.backtraces
58
+ rescue SystemCallError => e
59
+ STDERR.puts "*** ERROR: Cannot query status for Passenger instance #{control_process.pid}:"
60
+ STDERR.puts e.to_s
61
+ exit 2
62
+ end
63
+
64
+ # Colorize output
65
+ text.gsub!(/^(Thread .*:)$/, BLACK_BG + YELLOW + '\1' + RESET)
66
+ text.gsub!(/^( +in '.*? )(.*?)\(/, '\1' + BOLD + '\2' + RESET + '(')
67
+
68
+ puts text
44
69
  end
45
- # Colorize output
46
- text.gsub!(/^(----)(.*)$/, YELLOW + BLUE_BG + BOLD + '\1\2' + RESET)
47
- text.gsub!(/^( +in '.*? )(.*?)\(/, '\1' + BOLD + '\2' + RESET + '(')
48
- puts text
49
70
  end
50
71
 
51
72
  def start
73
+ options = { :show => 'pool' }
74
+ parser = OptionParser.new do |opts|
75
+ opts.banner = "Usage: passenger-status [options] [Phusion Passenger's PID]"
76
+ opts.separator ""
77
+ opts.separator "Tool for inspecting Phusion Passenger's internal status."
78
+ opts.separator ""
79
+
80
+ opts.separator "Options:"
81
+ opts.on("--show=pool|backtraces", String,
82
+ "Whether to show the pool's contents or\n" <<
83
+ "#{' ' * 37}the backtraces of all threads.") do |what|
84
+ if what !~ /\A(pool|backtraces)\Z/
85
+ STDERR.puts "Invalid argument for --show."
86
+ exit 1
87
+ else
88
+ options[:show] = what
89
+ end
90
+ end
91
+ end
92
+ begin
93
+ parser.parse!
94
+ rescue OptionParser::ParseError => e
95
+ puts e
96
+ puts
97
+ puts "Please see '--help' for valid options."
98
+ exit 1
99
+ end
100
+
52
101
  if ARGV.empty?
53
102
  control_processes = ControlProcess.list
54
103
  if control_processes.empty?
55
104
  STDERR.puts("ERROR: Phusion Passenger doesn't seem to be running.")
56
105
  exit 2
57
106
  elsif control_processes.size == 1
58
- show_status(control_processes.first)
107
+ show_status(control_processes.first, options)
59
108
  else
60
109
  puts "It appears that multiple Passenger instances are running. Please select a"
61
110
  puts "specific one by running:"
@@ -69,7 +118,7 @@ def start
69
118
  exit 1
70
119
  end
71
120
  else
72
- show_status(ControlProcess.for_pid(ARGV[0].to_i))
121
+ show_status(ControlProcess.for_pid(ARGV[0].to_i), options)
73
122
  end
74
123
  end
75
124
 
@@ -22,8 +22,8 @@
22
22
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
23
  # THE SOFTWARE.
24
24
 
25
- $LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/../lib")
26
- $LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/../ext")
25
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
26
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../ext"))
27
27
  require 'rubygems'
28
28
  require 'optparse'
29
29
  require 'socket'
@@ -65,12 +65,6 @@ explicitly define some special types:
65
65
  application instance in this domain may process. After having processed this
66
66
  many requests, the application instance will be shut down.
67
67
  A value of 0 indicates that there is no maximum.
68
-
69
- * restart_file_checker
70
- An object which monitors the restart.txt file, which belongs to this
71
- application root, for changes. This object has the method changed(),
72
- which rteurns whether restart.txt's timestamp has changed since the last
73
- check.
74
68
 
75
69
  - AppContainer
76
70
  A compound type (class) which contains an application instance, as well as
@@ -99,7 +93,7 @@ explicitly define some special types:
99
93
  A structure containing additional information used by the spawn manager's
100
94
  spawning process, as well as by the get() function.
101
95
 
102
- A PoolOptions has the following members:
96
+ A PoolOptions has at least the following members:
103
97
  * max_requests (unsigned integer) - The maximum number of requests that the
104
98
  application instance may process. After having processed this many requests,
105
99
  the application instance will be shut down. A value of 0 indicates that there
@@ -107,6 +101,9 @@ explicitly define some special types:
107
101
  * use_global_queue (boolean) - Whether to use a global queue for all
108
102
  application instances, or a queue that's private to the application instance.
109
103
  The users guide explains this feature in more detail.
104
+ * restart_dir (string) - The directory in which the algorithm should look for
105
+ restart.txt and always_restart.txt. The existance and modification times of
106
+ these files tell the algorithm whether an application should be restarted.
110
107
 
111
108
  === Special functions
112
109
 
@@ -226,17 +223,18 @@ function get(app_root, options):
226
223
  function spawn_or_use_existing(app_root, options):
227
224
  domain = domains[app_root]
228
225
 
229
- if (domain != nil) and (needs_restart(app_root, domain)):
230
- for all container in domain.instances:
231
- if container.sessions == 0:
232
- inactive_apps.remove(container.ia_iterator)
233
- else:
234
- active--
235
- domain.instances.remove(container.iterator)
236
- count--
237
- domains.remove(app_root)
238
- list = nil
226
+ if needs_restart(app_root, options):
227
+ if (domain != nil):
228
+ for all container in domain.instances:
229
+ if container.sessions == 0:
230
+ inactive_apps.remove(container.ia_iterator)
231
+ else:
232
+ active--
233
+ domain.instances.remove(container.iterator)
234
+ count--
235
+ domains.remove(app_root)
239
236
  Tell spawn server to reload code for app_root.
237
+ domain = nil
240
238
 
241
239
  if domain != nil:
242
240
  # There are apps for this app root.
@@ -320,7 +318,6 @@ function spawn_or_use_existing(app_root, options):
320
318
  if domain == nil:
321
319
  domain = new Domain
322
320
  initialize domain.instances
323
- initialize domain.restart_file_checker with "$app_root/tmp/restart.txt"
324
321
  domain.size = 1
325
322
  domain.max_requests = options.max_requests
326
323
  domains[app_root] = domain
@@ -362,10 +359,17 @@ function session_has_been_closed(container):
362
359
  active--
363
360
 
364
361
 
365
- function needs_restart(app_root, domain):
366
- always_restart_file = "$app_root/tmp/always_restart.txt"
367
- return (file_exists(always_restart_file)) or
368
- (domain.restart_file_checker.changed())
362
+ function needs_restart(app_root, options):
363
+ if (options.restart_dir is not set):
364
+ restart_dir = app_root + "/tmp"
365
+ else if (options.restart_dir is an absolute path):
366
+ restart_dir = options.restart_dir
367
+ else:
368
+ restart_dir = app_root + "/" + options.restart_dir
369
+
370
+ return (file_exists("$restart_dir/always_restart.txt")) or
371
+ (we haven't seen "$restart_dir/restart.txt" before) or
372
+ ("$restart_dir/restart.txt" changed since the last time we checked)
369
373
 
370
374
 
371
375
  # The following thread will be responsible for cleaning up idle application