passenger 4.0.30 → 4.0.31

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 (409) hide show
  1. data.tar.gz.asc +7 -7
  2. data/NEWS +31 -0
  3. data/bin/passenger +5 -5
  4. data/bin/passenger-config +6 -126
  5. data/bin/passenger-install-apache2-module +108 -26
  6. data/bin/passenger-install-nginx-module +81 -27
  7. data/bin/passenger-memory-stats +7 -6
  8. data/bin/passenger-status +13 -10
  9. data/build/agents.rb +8 -12
  10. data/build/apache2.rb +12 -7
  11. data/build/basics.rb +28 -20
  12. data/build/common_library.rb +4 -4
  13. data/build/cplusplus_support.rb +4 -4
  14. data/build/cxx_tests.rb +5 -3
  15. data/build/debian.rb +1 -2
  16. data/build/integration_tests.rb +25 -9
  17. data/build/misc.rb +2 -2
  18. data/build/oxt_tests.rb +5 -6
  19. data/build/packaging.rb +72 -40
  20. data/build/ruby_tests.rb +5 -1
  21. data/build/test_basics.rb +1 -2
  22. data/debian.template/locations.ini.template +1 -0
  23. data/debian.template/rules.template +2 -1
  24. data/dev/install_scripts_bootstrap_code.rb +42 -0
  25. data/dev/run_travis.sh +1 -0
  26. data/dev/runner +27 -0
  27. data/doc/Packaging.txt.md +5 -10
  28. data/doc/Users guide Apache.idmap.txt +3 -1
  29. data/doc/Users guide Apache.txt +5 -3
  30. data/doc/Users guide Nginx.idmap.txt +9 -5
  31. data/doc/Users guide Nginx.txt +47 -17
  32. data/doc/users_guide_snippets/environment_variables.txt +2 -2
  33. data/doc/users_guide_snippets/installation.txt +6 -2
  34. data/doc/users_guide_snippets/tips.txt +4 -0
  35. data/ext/apache2/Hooks.cpp +16 -3
  36. data/ext/common/Account.h +6 -5
  37. data/ext/common/AgentsStarter.h +1 -1
  38. data/ext/common/ApplicationPool2/Common.h +72 -0
  39. data/ext/common/ApplicationPool2/Group.h +263 -148
  40. data/ext/common/ApplicationPool2/Implementation.cpp +66 -44
  41. data/ext/common/ApplicationPool2/Options.h +1 -7
  42. data/ext/common/ApplicationPool2/Pool.h +96 -72
  43. data/ext/common/ApplicationPool2/Process.h +12 -17
  44. data/ext/common/ApplicationPool2/Socket.h +4 -4
  45. data/ext/common/ApplicationPool2/SuperGroup.h +20 -17
  46. data/ext/common/Constants.h +15 -1
  47. data/ext/common/MessageServer.h +22 -0
  48. data/ext/common/Utils.cpp +4 -1
  49. data/ext/common/Utils.h +3 -1
  50. data/ext/common/Utils/StrIntUtils.h +1 -0
  51. data/ext/common/Utils/Timer.h +15 -1
  52. data/ext/common/Utils/utf8/checked.h +0 -0
  53. data/ext/common/Utils/utf8/core.h +0 -0
  54. data/ext/common/Utils/utf8/unchecked.h +0 -0
  55. data/ext/common/agents/Base.cpp +59 -35
  56. data/ext/common/agents/HelperAgent/Main.cpp +23 -12
  57. data/ext/common/agents/HelperAgent/RequestHandler.h +10 -1
  58. data/ext/common/agents/LoggingAgent/FilterSupport.h +9 -5
  59. data/ext/common/agents/TempDirToucher.c +12 -3
  60. data/ext/common/agents/Watchdog/Main.cpp +8 -2
  61. data/ext/nginx/ConfigurationCommands.c +10 -0
  62. data/ext/nginx/ConfigurationFields.h +2 -0
  63. data/ext/nginx/ContentHandler.c +32 -19
  64. data/ext/nginx/CreateLocationConfig.c +5 -0
  65. data/ext/nginx/MergeLocationConfig.c +6 -0
  66. data/ext/nginx/config +13 -6
  67. data/ext/ruby/passenger_native_support.c +61 -2
  68. data/helper-scripts/classic-rails-loader.rb +9 -10
  69. data/helper-scripts/classic-rails-preloader.rb +10 -11
  70. data/helper-scripts/node-loader.js +3 -2
  71. data/helper-scripts/rack-loader.rb +8 -9
  72. data/helper-scripts/rack-preloader.rb +9 -10
  73. data/lib/phusion_passenger.rb +36 -7
  74. data/lib/phusion_passenger/abstract_installer.rb +16 -15
  75. data/lib/phusion_passenger/active_support3_extensions/init.rb +1 -1
  76. data/lib/phusion_passenger/admin_tools/memory_stats.rb +2 -2
  77. data/lib/phusion_passenger/admin_tools/server_instance.rb +5 -5
  78. data/lib/phusion_passenger/analytics_logger.rb +3 -3
  79. data/lib/phusion_passenger/classic_rails/thread_handler_extension.rb +1 -1
  80. data/lib/phusion_passenger/config.rb +125 -0
  81. data/lib/phusion_passenger/config/about_command.rb +183 -0
  82. data/lib/phusion_passenger/config/command.rb +57 -0
  83. data/lib/phusion_passenger/config/restart_app_command.rb +146 -0
  84. data/lib/phusion_passenger/config/utils.rb +108 -0
  85. data/lib/phusion_passenger/console_text_template.rb +2 -1
  86. data/lib/phusion_passenger/constants.rb +7 -2
  87. data/lib/phusion_passenger/loader_shared_helpers.rb +12 -21
  88. data/lib/phusion_passenger/message_client.rb +15 -4
  89. data/lib/phusion_passenger/native_support.rb +116 -98
  90. data/lib/phusion_passenger/nginx/config_options.rb +5 -0
  91. data/lib/phusion_passenger/platform_info.rb +1 -1
  92. data/lib/phusion_passenger/platform_info/apache.rb +9 -5
  93. data/lib/phusion_passenger/platform_info/apache_detector.rb +5 -6
  94. data/lib/phusion_passenger/platform_info/binary_compatibility.rb +3 -3
  95. data/lib/phusion_passenger/platform_info/compiler.rb +29 -11
  96. data/lib/phusion_passenger/platform_info/curl.rb +1 -1
  97. data/lib/phusion_passenger/platform_info/cxx_portability.rb +30 -16
  98. data/lib/phusion_passenger/platform_info/depcheck.rb +6 -6
  99. data/lib/phusion_passenger/platform_info/linux.rb +2 -2
  100. data/lib/phusion_passenger/platform_info/operating_system.rb +25 -5
  101. data/lib/phusion_passenger/platform_info/ruby.rb +7 -4
  102. data/lib/phusion_passenger/platform_info/zlib.rb +1 -1
  103. data/lib/phusion_passenger/plugin.rb +0 -1
  104. data/lib/phusion_passenger/preloader_shared_helpers.rb +1 -1
  105. data/lib/phusion_passenger/public_api.rb +1 -1
  106. data/lib/phusion_passenger/rack/thread_handler_extension.rb +1 -1
  107. data/lib/phusion_passenger/request_handler.rb +8 -9
  108. data/lib/phusion_passenger/request_handler/thread_handler.rb +21 -9
  109. data/lib/phusion_passenger/ruby_core_enhancements.rb +1 -1
  110. data/lib/phusion_passenger/standalone/app_finder.rb +2 -2
  111. data/lib/phusion_passenger/standalone/command.rb +10 -8
  112. data/lib/phusion_passenger/standalone/help_command.rb +1 -1
  113. data/lib/phusion_passenger/standalone/main.rb +3 -3
  114. data/lib/phusion_passenger/standalone/package_runtime_command.rb +2 -2
  115. data/lib/phusion_passenger/standalone/runtime_installer.rb +55 -13
  116. data/lib/phusion_passenger/standalone/runtime_locator.rb +3 -3
  117. data/lib/phusion_passenger/standalone/start_command.rb +6 -7
  118. data/lib/phusion_passenger/standalone/status_command.rb +1 -1
  119. data/lib/phusion_passenger/standalone/stop_command.rb +1 -1
  120. data/lib/phusion_passenger/standalone/utils.rb +1 -1
  121. data/lib/phusion_passenger/standalone/version_command.rb +2 -3
  122. data/lib/phusion_passenger/utils.rb +1 -1
  123. data/lib/phusion_passenger/utils/download.rb +1 -2
  124. data/lib/phusion_passenger/utils/file_system_watcher.rb +1 -1
  125. data/lib/phusion_passenger/utils/hosts_file_parser.rb +1 -1
  126. data/lib/phusion_passenger/utils/tee_input.rb +1 -1
  127. data/lib/phusion_passenger/utils/terminal_choice_menu.rb +217 -0
  128. data/lib/phusion_passenger/utils/unseekable_socket.rb +1 -1
  129. data/resources/templates/apache2/config_snippets.txt.erb +2 -3
  130. data/resources/templates/apache2/deployment_example.txt.erb +2 -2
  131. data/resources/templates/apache2/notify_apache_module_installed.txt.erb +3 -0
  132. data/resources/templates/nginx/config_snippets.txt.erb +1 -1
  133. data/resources/templates/nginx/deployment_example.txt.erb +2 -2
  134. data/resources/templates/nginx/nginx_module_sources_not_available.txt.erb +11 -5
  135. data/rpm/Vagrantfile +1 -0
  136. data/test/cxx/ApplicationPool2/PoolTest.cpp +224 -35
  137. data/test/cxx/ApplicationPool2/ProcessTest.cpp +6 -6
  138. data/test/cxx/MessagePassingTest.cpp +1 -1
  139. data/test/cxx/RequestHandlerTest.cpp +26 -26
  140. data/test/integration_tests/apache2_tests.rb +162 -243
  141. data/test/integration_tests/native_packaging_spec.rb +10 -10
  142. data/test/integration_tests/nginx_tests.rb +87 -107
  143. data/test/integration_tests/shared/example_webapp_tests.rb +246 -0
  144. data/test/integration_tests/source_packaging_test.rb +2 -1
  145. data/test/integration_tests/standalone_tests.rb +34 -19
  146. data/test/ruby/admin_tools_spec.rb +4 -4
  147. data/test/ruby/analytics_logger_spec.rb +1 -1
  148. data/test/ruby/debug_logging_spec.rb +2 -2
  149. data/test/ruby/message_channel_spec.rb +1 -1
  150. data/test/ruby/request_handler_spec.rb +171 -64
  151. data/test/ruby/shared/loader_sharedspec.rb +5 -5
  152. data/test/ruby/shared/rails/analytics_logging_extensions_sharedspec.rb +2 -2
  153. data/test/ruby/spec_helper.rb +4 -4
  154. data/test/ruby/standalone/runtime_installer_spec.rb +1 -1
  155. data/test/ruby/standalone/runtime_locator_spec.rb +1 -1
  156. data/test/ruby/utils/file_system_watcher_spec.rb +1 -1
  157. data/test/ruby/utils/hosts_file_parser.rb +1 -1
  158. data/test/ruby/utils/unseekable_socket_spec.rb +1 -1
  159. data/test/ruby/utils_spec.rb +4 -4
  160. data/test/stub/apache2/httpd.conf.erb +5 -0
  161. data/test/stub/index.html +1 -0
  162. data/test/stub/rack/config.ru +80 -33
  163. data/test/stub/{rails_apps/1.2/empty/app/models → rack/public}/.gitignore +0 -0
  164. data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/Rakefile +0 -0
  165. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/controllers/application_controller.rb +0 -0
  166. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/controllers/recipes_controller.rb +0 -0
  167. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/controllers/uploads_controller.rb +0 -0
  168. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/controllers/welcome_controller.rb +0 -0
  169. data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/app/helpers/application_helper.rb +0 -0
  170. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/helpers/recipes_helper.rb +0 -0
  171. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/helpers/test_helper.rb +0 -0
  172. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/helpers/uploads_helper.rb +0 -0
  173. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/helpers/welcome_helper.rb +0 -0
  174. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/layouts/default.rhtml +0 -0
  175. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/recipes/create.rhtml +0 -0
  176. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/recipes/index.rhtml +0 -0
  177. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/recipes/new.rhtml +0 -0
  178. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/uploads/index.rhtml +0 -0
  179. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/uploads/new.html.erb +0 -0
  180. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/welcome/cached.rhtml +0 -0
  181. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/welcome/index.rhtml +0 -0
  182. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/boot.rb +0 -0
  183. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/database.yml +0 -0
  184. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/environment.rb +0 -0
  185. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/config/environments/development.rb +0 -0
  186. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/environments/production.rb +0 -0
  187. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/config/initializers/inflections.rb +0 -0
  188. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/config/initializers/mime_types.rb +0 -0
  189. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/routes.rb +0 -0
  190. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/log/useless.txt +0 -0
  191. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/.htaccess +0 -0
  192. data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/public/404.html +0 -0
  193. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/public/422.html +0 -0
  194. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/public/500.html +0 -0
  195. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/dispatch.cgi +0 -0
  196. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/dispatch.fcgi +0 -0
  197. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/dispatch.rb +0 -0
  198. data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/public/favicon.ico +0 -0
  199. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/images/angrywizard.gif +0 -0
  200. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/images/cookbook.gif +0 -0
  201. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/images/header.png +0 -0
  202. data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/public/images/rails.png +0 -0
  203. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/public/robots.txt +0 -0
  204. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/uploads.html +0 -0
  205. data/test/stub/{rails_apps/1.2/empty/db → rails2.3-mycook/public/uploads}/.gitignore +0 -0
  206. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/welcome/cached.html +0 -0
  207. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/about +0 -0
  208. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/console +0 -0
  209. data/test/stub/{rails_apps/2.2/empty → rails2.3-mycook}/script/dbconsole +0 -0
  210. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/destroy +0 -0
  211. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/generate +0 -0
  212. data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/performance/benchmarker +0 -0
  213. data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/performance/profiler +0 -0
  214. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/performance/request +0 -0
  215. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/plugin +0 -0
  216. data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/process/inspector +0 -0
  217. data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/process/reaper +0 -0
  218. data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/process/spawner +0 -0
  219. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/runner +0 -0
  220. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/server +0 -0
  221. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/sites/some.site/public/uploads.html +0 -0
  222. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/sites/some.site/public/welcome/cached.html +0 -0
  223. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/tmp/cache/useless.txt +0 -0
  224. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/tmp/pids/useless.txt +0 -0
  225. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/tmp/sessions/useless.txt +0 -0
  226. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/tmp/sockets/useless.txt +0 -0
  227. data/test/stub/rails2.3/app/controllers/foo_controller.rb +1 -1
  228. data/test/stub/rails2.3/config/routes.rb +1 -2
  229. data/test/stub/wsgi/passenger_wsgi.py +47 -8
  230. data/test/stub/{rails_apps/1.2/empty/public/stylesheets → wsgi/public}/.gitignore +0 -0
  231. data/test/support/apache2_controller.rb +2 -2
  232. data/test/support/nginx_controller.rb +11 -5
  233. data/test/support/placebo-preloader.rb +2 -2
  234. data/test/support/test_helper.rb +26 -7
  235. metadata +78 -240
  236. metadata.gz.asc +7 -7
  237. data/debian.template/repack.sh +0 -42
  238. data/debian.template/watch +0 -3
  239. data/test/integration_tests/cgi_environment_spec.rb +0 -36
  240. data/test/integration_tests/hello_world_rack_spec.rb +0 -43
  241. data/test/integration_tests/hello_world_wsgi_spec.rb +0 -41
  242. data/test/integration_tests/mycook_spec.rb +0 -166
  243. data/test/stub/rack/public/rack.jpg +0 -0
  244. data/test/stub/rails_apps/1.2/empty/.gitignore +0 -3
  245. data/test/stub/rails_apps/1.2/empty/app/controllers/application.rb +0 -7
  246. data/test/stub/rails_apps/1.2/empty/config/boot.rb +0 -108
  247. data/test/stub/rails_apps/1.2/empty/config/database.yml +0 -31
  248. data/test/stub/rails_apps/1.2/empty/config/environment.rb +0 -66
  249. data/test/stub/rails_apps/1.2/empty/config/environments/development.rb +0 -21
  250. data/test/stub/rails_apps/1.2/empty/config/environments/production.rb +0 -18
  251. data/test/stub/rails_apps/1.2/empty/config/environments/staging.rb +0 -18
  252. data/test/stub/rails_apps/1.2/empty/config/environments/test.rb +0 -19
  253. data/test/stub/rails_apps/1.2/empty/config/routes.rb +0 -23
  254. data/test/stub/rails_apps/1.2/empty/doc/README_FOR_APP +0 -2
  255. data/test/stub/rails_apps/1.2/empty/public/.htaccess +0 -40
  256. data/test/stub/rails_apps/1.2/empty/public/500.html +0 -30
  257. data/test/stub/rails_apps/1.2/empty/public/dispatch.cgi +0 -10
  258. data/test/stub/rails_apps/1.2/empty/public/dispatch.fcgi +0 -24
  259. data/test/stub/rails_apps/1.2/empty/public/dispatch.rb +0 -10
  260. data/test/stub/rails_apps/1.2/empty/public/robots.txt +0 -1
  261. data/test/stub/rails_apps/1.2/empty/script/about +0 -3
  262. data/test/stub/rails_apps/1.2/empty/script/breakpointer +0 -3
  263. data/test/stub/rails_apps/1.2/empty/script/console +0 -3
  264. data/test/stub/rails_apps/1.2/empty/script/destroy +0 -3
  265. data/test/stub/rails_apps/1.2/empty/script/generate +0 -3
  266. data/test/stub/rails_apps/1.2/empty/script/plugin +0 -3
  267. data/test/stub/rails_apps/1.2/empty/script/runner +0 -3
  268. data/test/stub/rails_apps/1.2/empty/script/server +0 -3
  269. data/test/stub/rails_apps/1.2/empty/test/test_helper.rb +0 -28
  270. data/test/stub/rails_apps/2.0/empty/.gitignore +0 -3
  271. data/test/stub/rails_apps/2.0/empty/Rakefile +0 -10
  272. data/test/stub/rails_apps/2.0/empty/app/controllers/application.rb +0 -10
  273. data/test/stub/rails_apps/2.0/empty/app/helpers/application_helper.rb +0 -3
  274. data/test/stub/rails_apps/2.0/empty/app/models/.gitignore +0 -0
  275. data/test/stub/rails_apps/2.0/empty/config/boot.rb +0 -108
  276. data/test/stub/rails_apps/2.0/empty/config/database.yml +0 -31
  277. data/test/stub/rails_apps/2.0/empty/config/environment.rb +0 -59
  278. data/test/stub/rails_apps/2.0/empty/config/environments/production.rb +0 -18
  279. data/test/stub/rails_apps/2.0/empty/config/environments/staging.rb +0 -18
  280. data/test/stub/rails_apps/2.0/empty/config/environments/test.rb +0 -22
  281. data/test/stub/rails_apps/2.0/empty/config/routes.rb +0 -35
  282. data/test/stub/rails_apps/2.0/empty/db/.gitignore +0 -0
  283. data/test/stub/rails_apps/2.0/empty/doc/README_FOR_APP +0 -2
  284. data/test/stub/rails_apps/2.0/empty/public/.htaccess +0 -40
  285. data/test/stub/rails_apps/2.0/empty/public/404.html +0 -30
  286. data/test/stub/rails_apps/2.0/empty/public/dispatch.cgi +0 -10
  287. data/test/stub/rails_apps/2.0/empty/public/dispatch.fcgi +0 -24
  288. data/test/stub/rails_apps/2.0/empty/public/dispatch.rb +0 -10
  289. data/test/stub/rails_apps/2.0/empty/public/favicon.ico +0 -0
  290. data/test/stub/rails_apps/2.0/empty/public/images/rails.png +0 -0
  291. data/test/stub/rails_apps/2.0/empty/public/stylesheets/.gitignore +0 -0
  292. data/test/stub/rails_apps/2.0/empty/script/performance/benchmarker +0 -3
  293. data/test/stub/rails_apps/2.0/empty/script/performance/profiler +0 -3
  294. data/test/stub/rails_apps/2.0/empty/script/process/inspector +0 -3
  295. data/test/stub/rails_apps/2.0/empty/script/process/reaper +0 -3
  296. data/test/stub/rails_apps/2.0/empty/script/process/spawner +0 -3
  297. data/test/stub/rails_apps/2.0/empty/test/test_helper.rb +0 -38
  298. data/test/stub/rails_apps/2.2/empty/.gitignore +0 -3
  299. data/test/stub/rails_apps/2.2/empty/Rakefile +0 -10
  300. data/test/stub/rails_apps/2.2/empty/app/controllers/application.rb +0 -15
  301. data/test/stub/rails_apps/2.2/empty/app/helpers/application_helper.rb +0 -3
  302. data/test/stub/rails_apps/2.2/empty/app/models/.gitignore +0 -0
  303. data/test/stub/rails_apps/2.2/empty/config/boot.rb +0 -109
  304. data/test/stub/rails_apps/2.2/empty/config/database.yml +0 -31
  305. data/test/stub/rails_apps/2.2/empty/config/environment.rb +0 -75
  306. data/test/stub/rails_apps/2.2/empty/config/environments/development.rb +0 -17
  307. data/test/stub/rails_apps/2.2/empty/config/environments/production.rb +0 -24
  308. data/test/stub/rails_apps/2.2/empty/config/environments/staging.rb +0 -24
  309. data/test/stub/rails_apps/2.2/empty/config/environments/test.rb +0 -22
  310. data/test/stub/rails_apps/2.2/empty/config/initializers/inflections.rb +0 -10
  311. data/test/stub/rails_apps/2.2/empty/config/initializers/mime_types.rb +0 -5
  312. data/test/stub/rails_apps/2.2/empty/config/initializers/new_rails_defaults.rb +0 -17
  313. data/test/stub/rails_apps/2.2/empty/config/locales/en.yml +0 -5
  314. data/test/stub/rails_apps/2.2/empty/config/routes.rb +0 -43
  315. data/test/stub/rails_apps/2.2/empty/db/.gitignore +0 -0
  316. data/test/stub/rails_apps/2.2/empty/doc/README_FOR_APP +0 -5
  317. data/test/stub/rails_apps/2.2/empty/public/404.html +0 -30
  318. data/test/stub/rails_apps/2.2/empty/public/422.html +0 -30
  319. data/test/stub/rails_apps/2.2/empty/public/500.html +0 -33
  320. data/test/stub/rails_apps/2.2/empty/public/dispatch.cgi +0 -10
  321. data/test/stub/rails_apps/2.2/empty/public/dispatch.fcgi +0 -24
  322. data/test/stub/rails_apps/2.2/empty/public/dispatch.rb +0 -10
  323. data/test/stub/rails_apps/2.2/empty/public/favicon.ico +0 -0
  324. data/test/stub/rails_apps/2.2/empty/public/images/rails.png +0 -0
  325. data/test/stub/rails_apps/2.2/empty/public/robots.txt +0 -5
  326. data/test/stub/rails_apps/2.2/empty/public/stylesheets/.gitignore +0 -0
  327. data/test/stub/rails_apps/2.2/empty/script/about +0 -4
  328. data/test/stub/rails_apps/2.2/empty/script/console +0 -3
  329. data/test/stub/rails_apps/2.2/empty/script/destroy +0 -3
  330. data/test/stub/rails_apps/2.2/empty/script/generate +0 -3
  331. data/test/stub/rails_apps/2.2/empty/script/performance/benchmarker +0 -3
  332. data/test/stub/rails_apps/2.2/empty/script/performance/profiler +0 -3
  333. data/test/stub/rails_apps/2.2/empty/script/performance/request +0 -3
  334. data/test/stub/rails_apps/2.2/empty/script/plugin +0 -3
  335. data/test/stub/rails_apps/2.2/empty/script/process/inspector +0 -3
  336. data/test/stub/rails_apps/2.2/empty/script/process/reaper +0 -3
  337. data/test/stub/rails_apps/2.2/empty/script/process/spawner +0 -3
  338. data/test/stub/rails_apps/2.2/empty/script/runner +0 -3
  339. data/test/stub/rails_apps/2.2/empty/script/server +0 -3
  340. data/test/stub/rails_apps/2.2/empty/test/performance/browsing_test.rb +0 -9
  341. data/test/stub/rails_apps/2.2/empty/test/test_helper.rb +0 -38
  342. data/test/stub/rails_apps/2.3/empty/.gitignore +0 -3
  343. data/test/stub/rails_apps/2.3/empty/Rakefile +0 -10
  344. data/test/stub/rails_apps/2.3/empty/app/controllers/application_controller.rb +0 -10
  345. data/test/stub/rails_apps/2.3/empty/app/helpers/application_helper.rb +0 -3
  346. data/test/stub/rails_apps/2.3/empty/app/models/.gitignore +0 -0
  347. data/test/stub/rails_apps/2.3/empty/config/boot.rb +0 -110
  348. data/test/stub/rails_apps/2.3/empty/config/database.yml +0 -31
  349. data/test/stub/rails_apps/2.3/empty/config/environment.rb +0 -41
  350. data/test/stub/rails_apps/2.3/empty/config/environments/development.rb +0 -17
  351. data/test/stub/rails_apps/2.3/empty/config/environments/production.rb +0 -28
  352. data/test/stub/rails_apps/2.3/empty/config/environments/staging.rb +0 -28
  353. data/test/stub/rails_apps/2.3/empty/config/environments/test.rb +0 -28
  354. data/test/stub/rails_apps/2.3/empty/config/initializers/backtrace_silencers.rb +0 -7
  355. data/test/stub/rails_apps/2.3/empty/config/initializers/inflections.rb +0 -10
  356. data/test/stub/rails_apps/2.3/empty/config/initializers/mime_types.rb +0 -5
  357. data/test/stub/rails_apps/2.3/empty/config/initializers/new_rails_defaults.rb +0 -21
  358. data/test/stub/rails_apps/2.3/empty/config/initializers/session_store.rb +0 -15
  359. data/test/stub/rails_apps/2.3/empty/config/locales/en.yml +0 -5
  360. data/test/stub/rails_apps/2.3/empty/config/routes.rb +0 -43
  361. data/test/stub/rails_apps/2.3/empty/db/.gitignore +0 -0
  362. data/test/stub/rails_apps/2.3/empty/db/seeds.rb +0 -7
  363. data/test/stub/rails_apps/2.3/empty/doc/README_FOR_APP +0 -2
  364. data/test/stub/rails_apps/2.3/empty/public/404.html +0 -30
  365. data/test/stub/rails_apps/2.3/empty/public/422.html +0 -30
  366. data/test/stub/rails_apps/2.3/empty/public/500.html +0 -30
  367. data/test/stub/rails_apps/2.3/empty/public/favicon.ico +0 -0
  368. data/test/stub/rails_apps/2.3/empty/public/images/rails.png +0 -0
  369. data/test/stub/rails_apps/2.3/empty/public/robots.txt +0 -5
  370. data/test/stub/rails_apps/2.3/empty/public/stylesheets/.gitignore +0 -0
  371. data/test/stub/rails_apps/2.3/empty/script/about +0 -4
  372. data/test/stub/rails_apps/2.3/empty/script/console +0 -3
  373. data/test/stub/rails_apps/2.3/empty/script/dbconsole +0 -3
  374. data/test/stub/rails_apps/2.3/empty/script/destroy +0 -3
  375. data/test/stub/rails_apps/2.3/empty/script/generate +0 -3
  376. data/test/stub/rails_apps/2.3/empty/script/performance/benchmarker +0 -3
  377. data/test/stub/rails_apps/2.3/empty/script/performance/profiler +0 -3
  378. data/test/stub/rails_apps/2.3/empty/script/plugin +0 -3
  379. data/test/stub/rails_apps/2.3/empty/script/runner +0 -3
  380. data/test/stub/rails_apps/2.3/empty/script/server +0 -3
  381. data/test/stub/rails_apps/2.3/empty/test/performance/browsing_test.rb +0 -9
  382. data/test/stub/rails_apps/2.3/empty/test/test_helper.rb +0 -38
  383. data/test/stub/rails_apps/2.3/mycook/Rakefile +0 -10
  384. data/test/stub/rails_apps/2.3/mycook/app/helpers/application_helper.rb +0 -3
  385. data/test/stub/rails_apps/2.3/mycook/config/environments/development.rb +0 -18
  386. data/test/stub/rails_apps/2.3/mycook/config/initializers/inflections.rb +0 -10
  387. data/test/stub/rails_apps/2.3/mycook/config/initializers/mime_types.rb +0 -5
  388. data/test/stub/rails_apps/2.3/mycook/public/404.html +0 -30
  389. data/test/stub/rails_apps/2.3/mycook/public/422.html +0 -30
  390. data/test/stub/rails_apps/2.3/mycook/public/500.html +0 -30
  391. data/test/stub/rails_apps/2.3/mycook/public/favicon.ico +0 -0
  392. data/test/stub/rails_apps/2.3/mycook/public/images/rails.png +0 -0
  393. data/test/stub/rails_apps/2.3/mycook/public/robots.txt +0 -5
  394. data/test/stub/rails_apps/2.3/mycook/public/uploads/.gitignore +0 -0
  395. data/test/stub/rails_apps/2.3/mycook/script/about +0 -3
  396. data/test/stub/rails_apps/2.3/mycook/script/console +0 -3
  397. data/test/stub/rails_apps/2.3/mycook/script/dbconsole +0 -3
  398. data/test/stub/rails_apps/2.3/mycook/script/destroy +0 -3
  399. data/test/stub/rails_apps/2.3/mycook/script/generate +0 -3
  400. data/test/stub/rails_apps/2.3/mycook/script/performance/benchmarker +0 -3
  401. data/test/stub/rails_apps/2.3/mycook/script/performance/profiler +0 -3
  402. data/test/stub/rails_apps/2.3/mycook/script/performance/request +0 -3
  403. data/test/stub/rails_apps/2.3/mycook/script/plugin +0 -3
  404. data/test/stub/rails_apps/2.3/mycook/script/process/inspector +0 -3
  405. data/test/stub/rails_apps/2.3/mycook/script/process/reaper +0 -3
  406. data/test/stub/rails_apps/2.3/mycook/script/process/spawner +0 -3
  407. data/test/stub/rails_apps/2.3/mycook/script/runner +0 -3
  408. data/test/stub/rails_apps/2.3/mycook/script/server +0 -3
  409. data/test/stub/wsgi/public/wsgi-snake.jpg +0 -0
@@ -21,7 +21,7 @@
21
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
22
  # THE SOFTWARE.
23
23
 
24
- require 'phusion_passenger/utils' # So that we can know whether #writev is supported.
24
+ PhusionPassenger.require_passenger_lib 'utils' # So that we can know whether #writev is supported.
25
25
 
26
26
  module PhusionPassenger
27
27
  module Utils
@@ -6,8 +6,7 @@ Please edit your Apache configuration file, and add these lines:
6
6
  <b>PassengerRoot <%= @passenger_root %></b>
7
7
  <b>PassengerDefaultRuby <%= @ruby %></b>
8
8
 
9
- After you restart Apache, you are ready to deploy any number of Ruby on Rails
10
- applications on Apache, without any further Ruby on Rails-specific
11
- configuration!
9
+ After you restart Apache, you are ready to deploy any number of web
10
+ applications on Apache, with a minimum amount of configuration!
12
11
 
13
12
  <b>Press ENTER to continue.</b>
@@ -1,6 +1,6 @@
1
- <banner>Deploying a Ruby on Rails application: an example</banner>
1
+ <banner>Deploying a web application: an example</banner>
2
2
 
3
- Suppose you have a Rails application in <b>/somewhere</b>. Add a virtual host to your
3
+ Suppose you have a web application in <b>/somewhere</b>. Add a virtual host to your
4
4
  Apache configuration file and set its DocumentRoot to <b>/somewhere/public</b>:
5
5
  <b>
6
6
  <VirtualHost *:80>
@@ -0,0 +1,3 @@
1
+ <green>The <%= PROGRAM_NAME %> Apache module is correctly installed :-)</green>
2
+
3
+ Press Enter to learn how to deploy a web app on Apache.
@@ -11,7 +11,7 @@ and set the <b>passenger_root</b> and <b>passenger_ruby</b> configuration option
11
11
  ...
12
12
  }</b>
13
13
 
14
- After you (re)start Nginx, you are ready to deploy any number of Ruby on Rails
14
+ After you (re)start Nginx, you are ready to deploy any number of web
15
15
  applications on Nginx.
16
16
 
17
17
  <b>Press ENTER to continue.</b>
@@ -1,6 +1,6 @@
1
- <banner>Deploying a Ruby on Rails application: an example</banner>
1
+ <banner>Deploying a web application: an example</banner>
2
2
 
3
- Suppose you have a Ruby on Rails application in <b>/somewhere</b>. Add a <b>server</b> block
3
+ Suppose you have a web application in <b>/somewhere</b>. Add a <b>server</b> block
4
4
  to your Nginx configuration file, set its <b>root</b> to <b>/somewhere/public</b>, and set
5
5
  <b>'passenger_enabled on'</b>, like this:
6
6
  <b>
@@ -1,6 +1,12 @@
1
- <red>Nginx module sources not available</red>
1
+ <red>The necessary source files for compiling Nginx are not installed.</red>
2
+ <% if PhusionPassenger.native_packaging_method == "deb" %>
3
+ Please install them with:
2
4
 
3
- You didn't install the Phusion Passenger Nginx module sources. If you're on
4
- Debian or Ubuntu, please run <b>sudo apt-get install ruby-passenger-dev</b>
5
- first. If you're not on Debian/Ubuntu, or if you cannot run apt-get, please
6
- install Phusion Passenger from source: https://www.phusionpassenger.com/
5
+ <b>sudo apt-get install <%= DEB_DEV_PACKAGE %></b>
6
+ <% elsif PhusionPassenger.native_packaging_method == "rpm" %>
7
+ Please install them with:
8
+
9
+ <b>sudo yum install <%= RPM_DEV_PACKAGE %></b>
10
+ <% else %>
11
+ Please ask your operating system vendor how to solve this problem.
12
+ <% end %>
@@ -19,6 +19,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
19
19
  end
20
20
 
21
21
  pkg_cmd = %Q{
22
+ echo "exclude = kernel*" >> /etc/yum.conf
22
23
  rpm -Uvh http://mirror.overthewire.com.au/pub/epel/6/i386/epel-release-6-8.noarch.rpm &&
23
24
  yum update -y &&
24
25
  yum install -y @development-tools fedora-packager git sudo nano &&
@@ -162,7 +162,7 @@ namespace tut {
162
162
  ProcessPtr process = currentSession->getProcess();
163
163
  currentSession.reset();
164
164
  EVENTUALLY(5,
165
- result = process->utilization() == 0;
165
+ result = process->busyness() == 0;
166
166
  );
167
167
  return body;
168
168
  }
@@ -233,8 +233,8 @@ namespace tut {
233
233
  // Close the session so that the process is now idle.
234
234
  ProcessPtr process = currentSession->getProcess();
235
235
  currentSession.reset();
236
- ensure_equals(process->utilization(), 0);
237
- ensure(!process->atFullCapacity());
236
+ ensure_equals(process->busyness(), 0);
237
+ ensure(!process->isTotallyBusy());
238
238
 
239
239
  // Verify test assertion.
240
240
  ScopedLock l(pool->syncher);
@@ -262,7 +262,7 @@ namespace tut {
262
262
  ProcessPtr process = session1->getProcess();
263
263
  currentSession.reset();
264
264
  ensure_equals(process->sessions, 1);
265
- ensure(process->atFullCapacity());
265
+ ensure(process->isTotallyBusy());
266
266
 
267
267
  // Now call asyncGet() again.
268
268
  pool->asyncGet(options, callback);
@@ -577,7 +577,7 @@ namespace tut {
577
577
  debug->messages->send("Proceed with spawn loop iteration 1");
578
578
  ensureMinProcesses(1);
579
579
 
580
- ensure_equals(pool->restartGroupsByAppRoot("stub/rack"), 1u);
580
+ ensure(pool->restartGroupByName("stub/rack#default"));
581
581
  debug->debugger->recv("About to end restarting");
582
582
  ensure(pool->detachSuperGroupByName("stub/rack"));
583
583
  ensure_equals(pool->getSuperGroupCount(), 0u);
@@ -620,6 +620,38 @@ namespace tut {
620
620
  ensure(pool->detachSuperGroupByName("stub/rack"));
621
621
  ensure_equals(pool->getSuperGroupCount(), 0u);
622
622
  }
623
+
624
+ TEST_METHOD(17) {
625
+ // Test that restartGroupByName() spawns more processes to ensure
626
+ // that minProcesses and other constraints are met.
627
+ ensureMinProcesses(1);
628
+ ensure(pool->restartGroupByName("stub/rack#default"));
629
+ EVENTUALLY(5,
630
+ result = pool->getProcessCount() == 1;
631
+ );
632
+ }
633
+
634
+ TEST_METHOD(18) {
635
+ // Test getting from an app for which minProcesses is set to 0,
636
+ // and restart.txt already existed.
637
+ TempDirCopy dir("stub/wsgi", "tmp.wsgi");
638
+ Options options = createOptions();
639
+ options.appRoot = "tmp.wsgi";
640
+ options.appType = "wsgi";
641
+ options.spawnMethod = "direct";
642
+ options.minProcesses = 0;
643
+ initPoolDebugging();
644
+ debug->spawning = false;
645
+
646
+ touchFile("tmp.wsgi/tmp/restart.txt", 1);
647
+ pool->asyncGet(options, callback, false);
648
+ debug->debugger->recv("About to end restarting");
649
+ debug->messages->send("Finish restarting");
650
+ EVENTUALLY(5,
651
+ result = number == 1;
652
+ );
653
+ ensure_equals(pool->getProcessCount(), 1u);
654
+ }
623
655
 
624
656
 
625
657
  /*********** Test asyncGet() behavior on multiple SuperGroups,
@@ -675,7 +707,6 @@ namespace tut {
675
707
  EVENTUALLY(5,
676
708
  result = number == 1;
677
709
  );
678
- SessionPtr session1 = currentSession;
679
710
  ProcessPtr process1 = currentSession->getProcess();
680
711
  GroupPtr group1 = process1->getGroup();
681
712
  SuperGroupPtr superGroup1 = group1->getSuperGroup();
@@ -699,51 +730,210 @@ namespace tut {
699
730
  ensure_equals(pool->getProcessCount(), 2u);
700
731
  ensure_equals(superGroup1->getProcessCount(), 0u);
701
732
  }
702
-
733
+
703
734
  TEST_METHOD(22) {
704
- // Suppose the pool is full, and one tries to asyncGet() from a nonexistant group,
705
- // and the process that is selected for killing is the sole process in its group.
706
- // If there were waiters in the group then those waiters will be satisfied after
707
- // capacity has become free.
735
+ // Suppose the pool is at full capacity, and one tries to asyncGet() from an
736
+ // existant group that does not have any processes. It should kill a process
737
+ // from another group, and the request should succeed.
708
738
  Options options = createOptions();
709
- pool->setMax(2);
710
-
711
- // Get from /foo and retain its session.
739
+ SessionPtr session;
740
+ pid_t pid1, pid2;
741
+ pool->setMax(1);
742
+
743
+ // Create a group /foo.
712
744
  options.appRoot = "/foo";
713
745
  SystemTime::force(1);
714
- SessionPtr session1 = pool->get(options, &ticket);
715
- GroupPtr fooGroup = session1->getGroup();
746
+ session = pool->get(options, &ticket);
747
+ pid1 = session->getPid();
748
+ session.reset();
716
749
 
717
- // Get from /bar and retain its session.
750
+ // Create a group /bar.
718
751
  options.appRoot = "/bar";
719
752
  SystemTime::force(2);
720
- SessionPtr session2 = pool->get(options, &ticket);
753
+ session = pool->get(options, &ticket);
754
+ pid2 = session->getPid();
755
+ session.reset();
756
+
757
+ // Sleep for a short while to give Pool a chance to shutdown
758
+ // the first process.
759
+ usleep(300000);
760
+ ensure_equals("(1)", pool->getProcessCount(), 1u);
721
761
 
722
- // Request another get(). /foo will now have 1 waiter in its waitlist.
762
+ // Get from /foo.
723
763
  options.appRoot = "/foo";
724
- pool->asyncGet(options, callback);
764
+ SystemTime::force(3);
765
+ session = pool->get(options, &ticket);
766
+ ensure("(2)", session->getPid() != pid1);
767
+ ensure("(3)", session->getPid() != pid2);
768
+ ensure_equals("(4)", pool->getProcessCount(), 1u);
769
+ }
770
+
771
+ TEST_METHOD(23) {
772
+ // Suppose the pool is at full capacity, and one tries to asyncGet() from an
773
+ // existant group that does not have any processes, and that happens to need
774
+ // restarting. It should kill a process from another group and the request
775
+ // should succeed.
776
+ Options options1 = createOptions();
777
+ Options options2 = createOptions();
778
+ TempDirCopy dir("stub/wsgi", "tmp.wsgi");
779
+ SessionPtr session;
780
+ pid_t pid1, pid2;
781
+ pool->setMax(1);
782
+
783
+ // Create a group tmp.wsgi.
784
+ options1.appRoot = "tmp.wsgi";
785
+ options1.appType = "wsgi";
786
+ options1.spawnMethod = "direct";
787
+ SystemTime::force(1);
788
+ session = pool->get(options1, &ticket);
789
+ pid1 = session->getPid();
790
+ session.reset();
791
+
792
+ // Create a group bar.
793
+ options2.appRoot = "bar";
794
+ SystemTime::force(2);
795
+ session = pool->get(options2, &ticket);
796
+ pid2 = session->getPid();
797
+ session.reset();
798
+
799
+ // Sleep for a short while to give Pool a chance to shutdown
800
+ // the first process.
801
+ usleep(300000);
802
+ ensure_equals("(1)", pool->getProcessCount(), 1u);
803
+
804
+ // Get from tmp.wsgi.
805
+ SystemTime::force(3);
806
+ touchFile("tmp.wsgi/tmp/restart.txt", 4);
807
+ session = pool->get(options1, &ticket);
808
+ ensure("(2)", session->getPid() != pid1);
809
+ ensure("(3)", session->getPid() != pid2);
810
+ ensure_equals("(4)", pool->getProcessCount(), 1u);
811
+ }
812
+
813
+ TEST_METHOD(24) {
814
+ // Suppose the pool is at full capacity, with two groups:
815
+ // - one that is spawning a process.
816
+ // - one with no processes.
817
+ // When one tries to asyncGet() from the second group, there should
818
+ // be no process to kill, but when the first group is done spawning
819
+ // it should throw away that process immediately to allow the second
820
+ // group to spawn.
821
+ Options options1 = createOptions();
822
+ Options options2 = createOptions();
823
+ initPoolDebugging();
824
+ debug->restarting = false;
825
+ pool->setMax(1);
826
+
827
+ // Create a group foo.
828
+ options1.appRoot = "foo";
829
+ options1.noop = true;
830
+ SystemTime::force(1);
831
+ pool->get(options1, &ticket);
832
+
833
+ // Create a group bar, but don't let it finish spawning.
834
+ options2.appRoot = "bar";
835
+ options2.noop = true;
836
+ SystemTime::force(2);
837
+ GroupPtr barGroup = pool->get(options2, &ticket)->getGroup();
725
838
  {
726
839
  LockGuard l(pool->syncher);
727
- ensure("(1)", session1->getProcess()->isAlive());
728
- ensure_equals("(3)", fooGroup->getWaitlist.size(), 1u);
840
+ ensure_equals("(1)", barGroup->spawn(), SR_OK);
729
841
  }
842
+ debug->debugger->recv("Begin spawn loop iteration 1");
730
843
 
731
- // This kill the process for /foo.
844
+ // Now get from foo again and let the request be queued.
845
+ options1.noop = false;
732
846
  SystemTime::force(3);
733
- options.appRoot = "/baz";
734
- SessionPtr session3 = pool->get(options, &ticket);
735
- {
847
+ pool->asyncGet(options1, callback);
848
+
849
+ // Nothing should happen while bar is spawning.
850
+ SHOULD_NEVER_HAPPEN(100,
851
+ result = number > 0;
852
+ );
853
+ ensure_equals("(2)", pool->getProcessCount(), 0u);
854
+
855
+ // Now let bar finish spawning. Eventually there should
856
+ // only be one process: the one for foo.
857
+ debug->messages->send("Proceed with spawn loop iteration 1");
858
+ debug->debugger->recv("Spawn loop done");
859
+ debug->messages->send("Proceed with spawn loop iteration 2");
860
+ debug->debugger->recv("Spawn loop done");
861
+ EVENTUALLY(5,
736
862
  LockGuard l(pool->syncher);
737
- ensure("(4)", session1->getProcess()->enabled == Process::DETACHED);
738
- ensure_equals("(6)", fooGroup->getWaitlist.size(), 1u);
739
- ensure_equals("(7)", pool->getWaitlist.size(), 0u);
740
- }
863
+ vector<ProcessPtr> processes = pool->getProcesses(false);
864
+ if (processes.size() == 1) {
865
+ GroupPtr group = processes[0]->getGroup();
866
+ result = group->name == "foo#default";
867
+ } else {
868
+ result = false;
869
+ }
870
+ );
871
+ }
741
872
 
742
- // Make process /bar available for killing.
743
- session2.reset();
873
+ TEST_METHOD(25) {
874
+ // Suppose the pool is at full capacity, with two groups:
875
+ // - one that is spawning a process, and has a queued request.
876
+ // - one with no processes.
877
+ // When one tries to asyncGet() from the second group, there should
878
+ // be no process to kill, but when the first group is done spawning
879
+ // it should throw away that process immediately to allow the second
880
+ // group to spawn.
881
+ Options options1 = createOptions();
882
+ Options options2 = createOptions();
883
+ initPoolDebugging();
884
+ debug->restarting = false;
885
+ pool->setMax(1);
886
+
887
+ // Create a group foo.
888
+ options1.appRoot = "foo";
889
+ options1.noop = true;
890
+ SystemTime::force(1);
891
+ pool->get(options1, &ticket);
892
+
893
+ // Create a group bar with a queued request, but don't let it finish spawning.
894
+ options2.appRoot = "bar";
895
+ SystemTime::force(2);
896
+ pool->asyncGet(options2, callback);
897
+ debug->debugger->recv("Begin spawn loop iteration 1");
898
+
899
+ // Now get from foo again and let the request be queued.
900
+ options1.noop = false;
901
+ SystemTime::force(3);
902
+ pool->asyncGet(options1, callback);
903
+
904
+ // Nothing should happen while bar is spawning.
905
+ SHOULD_NEVER_HAPPEN(100,
906
+ result = number > 0;
907
+ );
908
+ ensure_equals("(1)", pool->getProcessCount(), 0u);
909
+
910
+ // Now let bar finish spawning. The request for bar should be served.
911
+ debug->messages->send("Proceed with spawn loop iteration 1");
912
+ debug->debugger->recv("Spawn loop done");
744
913
  EVENTUALLY(5,
745
914
  result = number == 1;
746
915
  );
916
+ ensure_equals(currentSession->getGroup()->name, "bar#default");
917
+
918
+ // When that request is done, the process for bar should be killed,
919
+ // and a process for foo should be spawned.
920
+ currentSession.reset();
921
+ debug->messages->send("Proceed with spawn loop iteration 2");
922
+ debug->debugger->recv("Spawn loop done");
923
+ EVENTUALLY(5,
924
+ LockGuard l(pool->syncher);
925
+ vector<ProcessPtr> processes = pool->getProcesses(false);
926
+ if (processes.size() == 1) {
927
+ GroupPtr group = processes[0]->getGroup();
928
+ result = group->name == "foo#default";
929
+ } else {
930
+ result = false;
931
+ }
932
+ );
933
+
934
+ EVENTUALLY(5,
935
+ result = number == 2;
936
+ );
747
937
  }
748
938
 
749
939
 
@@ -1286,14 +1476,14 @@ namespace tut {
1286
1476
  pool->setMax(1);
1287
1477
 
1288
1478
  // Send normal request.
1289
- ensure_equals(sendRequest(options, "/"), "hello <b>world</b>");
1479
+ ensure_equals(sendRequest(options, "/"), "front page");
1290
1480
 
1291
1481
  // Modify application; it shouldn't have effect yet.
1292
1482
  writeFile("tmp.wsgi/passenger_wsgi.py",
1293
1483
  "def application(env, start_response):\n"
1294
1484
  " start_response('200 OK', [('Content-Type', 'text/html')])\n"
1295
1485
  " return ['restarted']\n");
1296
- ensure_equals(sendRequest(options, "/"), "hello <b>world</b>");
1486
+ ensure_equals(sendRequest(options, "/"), "front page");
1297
1487
 
1298
1488
  // Create restart.txt and send request again. The change should now be activated.
1299
1489
  touchFile("tmp.wsgi/tmp/restart.txt", 1);
@@ -1412,7 +1602,6 @@ namespace tut {
1412
1602
  Options options1 = createOptions();
1413
1603
  Options options2 = createOptions();
1414
1604
  options2.appRoot = "stub/wsgi";
1415
- options2.allowTrashingNonIdleProcesses = false;
1416
1605
 
1417
1606
  retainSessions = true;
1418
1607
  pool->setMax(2);
@@ -53,8 +53,8 @@ namespace tut {
53
53
  errorPipe[0], sockets, 0, 0);
54
54
  process->dummy = true;
55
55
  process->requiresShutdown = false;
56
- ensure_equals(process->utilization(), 0);
57
- ensure(!process->atFullCapacity());
56
+ ensure_equals(process->busyness(), 0);
57
+ ensure(!process->isTotallyBusy());
58
58
  }
59
59
 
60
60
  TEST_METHOD(2) {
@@ -74,8 +74,8 @@ namespace tut {
74
74
  }
75
75
 
76
76
  TEST_METHOD(3) {
77
- // newSession() checks out the socket with the smallest utilization number
78
- // and sessionClosed() restores the session utilization statistics.
77
+ // newSession() checks out the socket with the smallest busyness number
78
+ // and sessionClosed() restores the session busyness statistics.
79
79
  ProcessPtr process = boost::make_shared<Process>(bg.safe,
80
80
  123, "", "", adminSocket[0],
81
81
  errorPipe[0], sockets, 0, 0);
@@ -128,12 +128,12 @@ namespace tut {
128
128
  process->requiresShutdown = false;
129
129
  vector<SessionPtr> sessions;
130
130
  for (int i = 0; i < 9; i++) {
131
- ensure(!process->atFullCapacity());
131
+ ensure(!process->isTotallyBusy());
132
132
  SessionPtr session = process->newSession();
133
133
  ensure(session != NULL);
134
134
  sessions.push_back(session);
135
135
  }
136
- ensure(process->atFullCapacity());
136
+ ensure(process->isTotallyBusy());
137
137
  ensure(process->newSession() == NULL);
138
138
  }
139
139
  }