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.
- data.tar.gz.asc +7 -7
- data/NEWS +31 -0
- data/bin/passenger +5 -5
- data/bin/passenger-config +6 -126
- data/bin/passenger-install-apache2-module +108 -26
- data/bin/passenger-install-nginx-module +81 -27
- data/bin/passenger-memory-stats +7 -6
- data/bin/passenger-status +13 -10
- data/build/agents.rb +8 -12
- data/build/apache2.rb +12 -7
- data/build/basics.rb +28 -20
- data/build/common_library.rb +4 -4
- data/build/cplusplus_support.rb +4 -4
- data/build/cxx_tests.rb +5 -3
- data/build/debian.rb +1 -2
- data/build/integration_tests.rb +25 -9
- data/build/misc.rb +2 -2
- data/build/oxt_tests.rb +5 -6
- data/build/packaging.rb +72 -40
- data/build/ruby_tests.rb +5 -1
- data/build/test_basics.rb +1 -2
- data/debian.template/locations.ini.template +1 -0
- data/debian.template/rules.template +2 -1
- data/dev/install_scripts_bootstrap_code.rb +42 -0
- data/dev/run_travis.sh +1 -0
- data/dev/runner +27 -0
- data/doc/Packaging.txt.md +5 -10
- data/doc/Users guide Apache.idmap.txt +3 -1
- data/doc/Users guide Apache.txt +5 -3
- data/doc/Users guide Nginx.idmap.txt +9 -5
- data/doc/Users guide Nginx.txt +47 -17
- data/doc/users_guide_snippets/environment_variables.txt +2 -2
- data/doc/users_guide_snippets/installation.txt +6 -2
- data/doc/users_guide_snippets/tips.txt +4 -0
- data/ext/apache2/Hooks.cpp +16 -3
- data/ext/common/Account.h +6 -5
- data/ext/common/AgentsStarter.h +1 -1
- data/ext/common/ApplicationPool2/Common.h +72 -0
- data/ext/common/ApplicationPool2/Group.h +263 -148
- data/ext/common/ApplicationPool2/Implementation.cpp +66 -44
- data/ext/common/ApplicationPool2/Options.h +1 -7
- data/ext/common/ApplicationPool2/Pool.h +96 -72
- data/ext/common/ApplicationPool2/Process.h +12 -17
- data/ext/common/ApplicationPool2/Socket.h +4 -4
- data/ext/common/ApplicationPool2/SuperGroup.h +20 -17
- data/ext/common/Constants.h +15 -1
- data/ext/common/MessageServer.h +22 -0
- data/ext/common/Utils.cpp +4 -1
- data/ext/common/Utils.h +3 -1
- data/ext/common/Utils/StrIntUtils.h +1 -0
- data/ext/common/Utils/Timer.h +15 -1
- data/ext/common/Utils/utf8/checked.h +0 -0
- data/ext/common/Utils/utf8/core.h +0 -0
- data/ext/common/Utils/utf8/unchecked.h +0 -0
- data/ext/common/agents/Base.cpp +59 -35
- data/ext/common/agents/HelperAgent/Main.cpp +23 -12
- data/ext/common/agents/HelperAgent/RequestHandler.h +10 -1
- data/ext/common/agents/LoggingAgent/FilterSupport.h +9 -5
- data/ext/common/agents/TempDirToucher.c +12 -3
- data/ext/common/agents/Watchdog/Main.cpp +8 -2
- data/ext/nginx/ConfigurationCommands.c +10 -0
- data/ext/nginx/ConfigurationFields.h +2 -0
- data/ext/nginx/ContentHandler.c +32 -19
- data/ext/nginx/CreateLocationConfig.c +5 -0
- data/ext/nginx/MergeLocationConfig.c +6 -0
- data/ext/nginx/config +13 -6
- data/ext/ruby/passenger_native_support.c +61 -2
- data/helper-scripts/classic-rails-loader.rb +9 -10
- data/helper-scripts/classic-rails-preloader.rb +10 -11
- data/helper-scripts/node-loader.js +3 -2
- data/helper-scripts/rack-loader.rb +8 -9
- data/helper-scripts/rack-preloader.rb +9 -10
- data/lib/phusion_passenger.rb +36 -7
- data/lib/phusion_passenger/abstract_installer.rb +16 -15
- data/lib/phusion_passenger/active_support3_extensions/init.rb +1 -1
- data/lib/phusion_passenger/admin_tools/memory_stats.rb +2 -2
- data/lib/phusion_passenger/admin_tools/server_instance.rb +5 -5
- data/lib/phusion_passenger/analytics_logger.rb +3 -3
- data/lib/phusion_passenger/classic_rails/thread_handler_extension.rb +1 -1
- data/lib/phusion_passenger/config.rb +125 -0
- data/lib/phusion_passenger/config/about_command.rb +183 -0
- data/lib/phusion_passenger/config/command.rb +57 -0
- data/lib/phusion_passenger/config/restart_app_command.rb +146 -0
- data/lib/phusion_passenger/config/utils.rb +108 -0
- data/lib/phusion_passenger/console_text_template.rb +2 -1
- data/lib/phusion_passenger/constants.rb +7 -2
- data/lib/phusion_passenger/loader_shared_helpers.rb +12 -21
- data/lib/phusion_passenger/message_client.rb +15 -4
- data/lib/phusion_passenger/native_support.rb +116 -98
- data/lib/phusion_passenger/nginx/config_options.rb +5 -0
- data/lib/phusion_passenger/platform_info.rb +1 -1
- data/lib/phusion_passenger/platform_info/apache.rb +9 -5
- data/lib/phusion_passenger/platform_info/apache_detector.rb +5 -6
- data/lib/phusion_passenger/platform_info/binary_compatibility.rb +3 -3
- data/lib/phusion_passenger/platform_info/compiler.rb +29 -11
- data/lib/phusion_passenger/platform_info/curl.rb +1 -1
- data/lib/phusion_passenger/platform_info/cxx_portability.rb +30 -16
- data/lib/phusion_passenger/platform_info/depcheck.rb +6 -6
- data/lib/phusion_passenger/platform_info/linux.rb +2 -2
- data/lib/phusion_passenger/platform_info/operating_system.rb +25 -5
- data/lib/phusion_passenger/platform_info/ruby.rb +7 -4
- data/lib/phusion_passenger/platform_info/zlib.rb +1 -1
- data/lib/phusion_passenger/plugin.rb +0 -1
- data/lib/phusion_passenger/preloader_shared_helpers.rb +1 -1
- data/lib/phusion_passenger/public_api.rb +1 -1
- data/lib/phusion_passenger/rack/thread_handler_extension.rb +1 -1
- data/lib/phusion_passenger/request_handler.rb +8 -9
- data/lib/phusion_passenger/request_handler/thread_handler.rb +21 -9
- data/lib/phusion_passenger/ruby_core_enhancements.rb +1 -1
- data/lib/phusion_passenger/standalone/app_finder.rb +2 -2
- data/lib/phusion_passenger/standalone/command.rb +10 -8
- data/lib/phusion_passenger/standalone/help_command.rb +1 -1
- data/lib/phusion_passenger/standalone/main.rb +3 -3
- data/lib/phusion_passenger/standalone/package_runtime_command.rb +2 -2
- data/lib/phusion_passenger/standalone/runtime_installer.rb +55 -13
- data/lib/phusion_passenger/standalone/runtime_locator.rb +3 -3
- data/lib/phusion_passenger/standalone/start_command.rb +6 -7
- data/lib/phusion_passenger/standalone/status_command.rb +1 -1
- data/lib/phusion_passenger/standalone/stop_command.rb +1 -1
- data/lib/phusion_passenger/standalone/utils.rb +1 -1
- data/lib/phusion_passenger/standalone/version_command.rb +2 -3
- data/lib/phusion_passenger/utils.rb +1 -1
- data/lib/phusion_passenger/utils/download.rb +1 -2
- data/lib/phusion_passenger/utils/file_system_watcher.rb +1 -1
- data/lib/phusion_passenger/utils/hosts_file_parser.rb +1 -1
- data/lib/phusion_passenger/utils/tee_input.rb +1 -1
- data/lib/phusion_passenger/utils/terminal_choice_menu.rb +217 -0
- data/lib/phusion_passenger/utils/unseekable_socket.rb +1 -1
- data/resources/templates/apache2/config_snippets.txt.erb +2 -3
- data/resources/templates/apache2/deployment_example.txt.erb +2 -2
- data/resources/templates/apache2/notify_apache_module_installed.txt.erb +3 -0
- data/resources/templates/nginx/config_snippets.txt.erb +1 -1
- data/resources/templates/nginx/deployment_example.txt.erb +2 -2
- data/resources/templates/nginx/nginx_module_sources_not_available.txt.erb +11 -5
- data/rpm/Vagrantfile +1 -0
- data/test/cxx/ApplicationPool2/PoolTest.cpp +224 -35
- data/test/cxx/ApplicationPool2/ProcessTest.cpp +6 -6
- data/test/cxx/MessagePassingTest.cpp +1 -1
- data/test/cxx/RequestHandlerTest.cpp +26 -26
- data/test/integration_tests/apache2_tests.rb +162 -243
- data/test/integration_tests/native_packaging_spec.rb +10 -10
- data/test/integration_tests/nginx_tests.rb +87 -107
- data/test/integration_tests/shared/example_webapp_tests.rb +246 -0
- data/test/integration_tests/source_packaging_test.rb +2 -1
- data/test/integration_tests/standalone_tests.rb +34 -19
- data/test/ruby/admin_tools_spec.rb +4 -4
- data/test/ruby/analytics_logger_spec.rb +1 -1
- data/test/ruby/debug_logging_spec.rb +2 -2
- data/test/ruby/message_channel_spec.rb +1 -1
- data/test/ruby/request_handler_spec.rb +171 -64
- data/test/ruby/shared/loader_sharedspec.rb +5 -5
- data/test/ruby/shared/rails/analytics_logging_extensions_sharedspec.rb +2 -2
- data/test/ruby/spec_helper.rb +4 -4
- data/test/ruby/standalone/runtime_installer_spec.rb +1 -1
- data/test/ruby/standalone/runtime_locator_spec.rb +1 -1
- data/test/ruby/utils/file_system_watcher_spec.rb +1 -1
- data/test/ruby/utils/hosts_file_parser.rb +1 -1
- data/test/ruby/utils/unseekable_socket_spec.rb +1 -1
- data/test/ruby/utils_spec.rb +4 -4
- data/test/stub/apache2/httpd.conf.erb +5 -0
- data/test/stub/index.html +1 -0
- data/test/stub/rack/config.ru +80 -33
- data/test/stub/{rails_apps/1.2/empty/app/models → rack/public}/.gitignore +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/Rakefile +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/controllers/application_controller.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/controllers/recipes_controller.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/controllers/uploads_controller.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/controllers/welcome_controller.rb +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/app/helpers/application_helper.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/helpers/recipes_helper.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/helpers/test_helper.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/helpers/uploads_helper.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/helpers/welcome_helper.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/layouts/default.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/recipes/create.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/recipes/index.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/recipes/new.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/uploads/index.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/uploads/new.html.erb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/welcome/cached.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/welcome/index.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/boot.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/database.yml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/environment.rb +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/config/environments/development.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/environments/production.rb +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/config/initializers/inflections.rb +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/config/initializers/mime_types.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/routes.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/log/useless.txt +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/.htaccess +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/public/404.html +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/public/422.html +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/public/500.html +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/dispatch.cgi +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/dispatch.fcgi +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/dispatch.rb +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/public/favicon.ico +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/images/angrywizard.gif +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/images/cookbook.gif +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/images/header.png +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/public/images/rails.png +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/public/robots.txt +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/uploads.html +0 -0
- data/test/stub/{rails_apps/1.2/empty/db → rails2.3-mycook/public/uploads}/.gitignore +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/welcome/cached.html +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/about +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/console +0 -0
- data/test/stub/{rails_apps/2.2/empty → rails2.3-mycook}/script/dbconsole +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/destroy +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/generate +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/performance/benchmarker +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/performance/profiler +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/performance/request +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/plugin +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/process/inspector +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/process/reaper +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/process/spawner +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/runner +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/server +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/sites/some.site/public/uploads.html +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/sites/some.site/public/welcome/cached.html +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/tmp/cache/useless.txt +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/tmp/pids/useless.txt +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/tmp/sessions/useless.txt +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/tmp/sockets/useless.txt +0 -0
- data/test/stub/rails2.3/app/controllers/foo_controller.rb +1 -1
- data/test/stub/rails2.3/config/routes.rb +1 -2
- data/test/stub/wsgi/passenger_wsgi.py +47 -8
- data/test/stub/{rails_apps/1.2/empty/public/stylesheets → wsgi/public}/.gitignore +0 -0
- data/test/support/apache2_controller.rb +2 -2
- data/test/support/nginx_controller.rb +11 -5
- data/test/support/placebo-preloader.rb +2 -2
- data/test/support/test_helper.rb +26 -7
- metadata +78 -240
- metadata.gz.asc +7 -7
- data/debian.template/repack.sh +0 -42
- data/debian.template/watch +0 -3
- data/test/integration_tests/cgi_environment_spec.rb +0 -36
- data/test/integration_tests/hello_world_rack_spec.rb +0 -43
- data/test/integration_tests/hello_world_wsgi_spec.rb +0 -41
- data/test/integration_tests/mycook_spec.rb +0 -166
- data/test/stub/rack/public/rack.jpg +0 -0
- data/test/stub/rails_apps/1.2/empty/.gitignore +0 -3
- data/test/stub/rails_apps/1.2/empty/app/controllers/application.rb +0 -7
- data/test/stub/rails_apps/1.2/empty/config/boot.rb +0 -108
- data/test/stub/rails_apps/1.2/empty/config/database.yml +0 -31
- data/test/stub/rails_apps/1.2/empty/config/environment.rb +0 -66
- data/test/stub/rails_apps/1.2/empty/config/environments/development.rb +0 -21
- data/test/stub/rails_apps/1.2/empty/config/environments/production.rb +0 -18
- data/test/stub/rails_apps/1.2/empty/config/environments/staging.rb +0 -18
- data/test/stub/rails_apps/1.2/empty/config/environments/test.rb +0 -19
- data/test/stub/rails_apps/1.2/empty/config/routes.rb +0 -23
- data/test/stub/rails_apps/1.2/empty/doc/README_FOR_APP +0 -2
- data/test/stub/rails_apps/1.2/empty/public/.htaccess +0 -40
- data/test/stub/rails_apps/1.2/empty/public/500.html +0 -30
- data/test/stub/rails_apps/1.2/empty/public/dispatch.cgi +0 -10
- data/test/stub/rails_apps/1.2/empty/public/dispatch.fcgi +0 -24
- data/test/stub/rails_apps/1.2/empty/public/dispatch.rb +0 -10
- data/test/stub/rails_apps/1.2/empty/public/robots.txt +0 -1
- data/test/stub/rails_apps/1.2/empty/script/about +0 -3
- data/test/stub/rails_apps/1.2/empty/script/breakpointer +0 -3
- data/test/stub/rails_apps/1.2/empty/script/console +0 -3
- data/test/stub/rails_apps/1.2/empty/script/destroy +0 -3
- data/test/stub/rails_apps/1.2/empty/script/generate +0 -3
- data/test/stub/rails_apps/1.2/empty/script/plugin +0 -3
- data/test/stub/rails_apps/1.2/empty/script/runner +0 -3
- data/test/stub/rails_apps/1.2/empty/script/server +0 -3
- data/test/stub/rails_apps/1.2/empty/test/test_helper.rb +0 -28
- data/test/stub/rails_apps/2.0/empty/.gitignore +0 -3
- data/test/stub/rails_apps/2.0/empty/Rakefile +0 -10
- data/test/stub/rails_apps/2.0/empty/app/controllers/application.rb +0 -10
- data/test/stub/rails_apps/2.0/empty/app/helpers/application_helper.rb +0 -3
- data/test/stub/rails_apps/2.0/empty/app/models/.gitignore +0 -0
- data/test/stub/rails_apps/2.0/empty/config/boot.rb +0 -108
- data/test/stub/rails_apps/2.0/empty/config/database.yml +0 -31
- data/test/stub/rails_apps/2.0/empty/config/environment.rb +0 -59
- data/test/stub/rails_apps/2.0/empty/config/environments/production.rb +0 -18
- data/test/stub/rails_apps/2.0/empty/config/environments/staging.rb +0 -18
- data/test/stub/rails_apps/2.0/empty/config/environments/test.rb +0 -22
- data/test/stub/rails_apps/2.0/empty/config/routes.rb +0 -35
- data/test/stub/rails_apps/2.0/empty/db/.gitignore +0 -0
- data/test/stub/rails_apps/2.0/empty/doc/README_FOR_APP +0 -2
- data/test/stub/rails_apps/2.0/empty/public/.htaccess +0 -40
- data/test/stub/rails_apps/2.0/empty/public/404.html +0 -30
- data/test/stub/rails_apps/2.0/empty/public/dispatch.cgi +0 -10
- data/test/stub/rails_apps/2.0/empty/public/dispatch.fcgi +0 -24
- data/test/stub/rails_apps/2.0/empty/public/dispatch.rb +0 -10
- data/test/stub/rails_apps/2.0/empty/public/favicon.ico +0 -0
- data/test/stub/rails_apps/2.0/empty/public/images/rails.png +0 -0
- data/test/stub/rails_apps/2.0/empty/public/stylesheets/.gitignore +0 -0
- data/test/stub/rails_apps/2.0/empty/script/performance/benchmarker +0 -3
- data/test/stub/rails_apps/2.0/empty/script/performance/profiler +0 -3
- data/test/stub/rails_apps/2.0/empty/script/process/inspector +0 -3
- data/test/stub/rails_apps/2.0/empty/script/process/reaper +0 -3
- data/test/stub/rails_apps/2.0/empty/script/process/spawner +0 -3
- data/test/stub/rails_apps/2.0/empty/test/test_helper.rb +0 -38
- data/test/stub/rails_apps/2.2/empty/.gitignore +0 -3
- data/test/stub/rails_apps/2.2/empty/Rakefile +0 -10
- data/test/stub/rails_apps/2.2/empty/app/controllers/application.rb +0 -15
- data/test/stub/rails_apps/2.2/empty/app/helpers/application_helper.rb +0 -3
- data/test/stub/rails_apps/2.2/empty/app/models/.gitignore +0 -0
- data/test/stub/rails_apps/2.2/empty/config/boot.rb +0 -109
- data/test/stub/rails_apps/2.2/empty/config/database.yml +0 -31
- data/test/stub/rails_apps/2.2/empty/config/environment.rb +0 -75
- data/test/stub/rails_apps/2.2/empty/config/environments/development.rb +0 -17
- data/test/stub/rails_apps/2.2/empty/config/environments/production.rb +0 -24
- data/test/stub/rails_apps/2.2/empty/config/environments/staging.rb +0 -24
- data/test/stub/rails_apps/2.2/empty/config/environments/test.rb +0 -22
- data/test/stub/rails_apps/2.2/empty/config/initializers/inflections.rb +0 -10
- data/test/stub/rails_apps/2.2/empty/config/initializers/mime_types.rb +0 -5
- data/test/stub/rails_apps/2.2/empty/config/initializers/new_rails_defaults.rb +0 -17
- data/test/stub/rails_apps/2.2/empty/config/locales/en.yml +0 -5
- data/test/stub/rails_apps/2.2/empty/config/routes.rb +0 -43
- data/test/stub/rails_apps/2.2/empty/db/.gitignore +0 -0
- data/test/stub/rails_apps/2.2/empty/doc/README_FOR_APP +0 -5
- data/test/stub/rails_apps/2.2/empty/public/404.html +0 -30
- data/test/stub/rails_apps/2.2/empty/public/422.html +0 -30
- data/test/stub/rails_apps/2.2/empty/public/500.html +0 -33
- data/test/stub/rails_apps/2.2/empty/public/dispatch.cgi +0 -10
- data/test/stub/rails_apps/2.2/empty/public/dispatch.fcgi +0 -24
- data/test/stub/rails_apps/2.2/empty/public/dispatch.rb +0 -10
- data/test/stub/rails_apps/2.2/empty/public/favicon.ico +0 -0
- data/test/stub/rails_apps/2.2/empty/public/images/rails.png +0 -0
- data/test/stub/rails_apps/2.2/empty/public/robots.txt +0 -5
- data/test/stub/rails_apps/2.2/empty/public/stylesheets/.gitignore +0 -0
- data/test/stub/rails_apps/2.2/empty/script/about +0 -4
- data/test/stub/rails_apps/2.2/empty/script/console +0 -3
- data/test/stub/rails_apps/2.2/empty/script/destroy +0 -3
- data/test/stub/rails_apps/2.2/empty/script/generate +0 -3
- data/test/stub/rails_apps/2.2/empty/script/performance/benchmarker +0 -3
- data/test/stub/rails_apps/2.2/empty/script/performance/profiler +0 -3
- data/test/stub/rails_apps/2.2/empty/script/performance/request +0 -3
- data/test/stub/rails_apps/2.2/empty/script/plugin +0 -3
- data/test/stub/rails_apps/2.2/empty/script/process/inspector +0 -3
- data/test/stub/rails_apps/2.2/empty/script/process/reaper +0 -3
- data/test/stub/rails_apps/2.2/empty/script/process/spawner +0 -3
- data/test/stub/rails_apps/2.2/empty/script/runner +0 -3
- data/test/stub/rails_apps/2.2/empty/script/server +0 -3
- data/test/stub/rails_apps/2.2/empty/test/performance/browsing_test.rb +0 -9
- data/test/stub/rails_apps/2.2/empty/test/test_helper.rb +0 -38
- data/test/stub/rails_apps/2.3/empty/.gitignore +0 -3
- data/test/stub/rails_apps/2.3/empty/Rakefile +0 -10
- data/test/stub/rails_apps/2.3/empty/app/controllers/application_controller.rb +0 -10
- data/test/stub/rails_apps/2.3/empty/app/helpers/application_helper.rb +0 -3
- data/test/stub/rails_apps/2.3/empty/app/models/.gitignore +0 -0
- data/test/stub/rails_apps/2.3/empty/config/boot.rb +0 -110
- data/test/stub/rails_apps/2.3/empty/config/database.yml +0 -31
- data/test/stub/rails_apps/2.3/empty/config/environment.rb +0 -41
- data/test/stub/rails_apps/2.3/empty/config/environments/development.rb +0 -17
- data/test/stub/rails_apps/2.3/empty/config/environments/production.rb +0 -28
- data/test/stub/rails_apps/2.3/empty/config/environments/staging.rb +0 -28
- data/test/stub/rails_apps/2.3/empty/config/environments/test.rb +0 -28
- data/test/stub/rails_apps/2.3/empty/config/initializers/backtrace_silencers.rb +0 -7
- data/test/stub/rails_apps/2.3/empty/config/initializers/inflections.rb +0 -10
- data/test/stub/rails_apps/2.3/empty/config/initializers/mime_types.rb +0 -5
- data/test/stub/rails_apps/2.3/empty/config/initializers/new_rails_defaults.rb +0 -21
- data/test/stub/rails_apps/2.3/empty/config/initializers/session_store.rb +0 -15
- data/test/stub/rails_apps/2.3/empty/config/locales/en.yml +0 -5
- data/test/stub/rails_apps/2.3/empty/config/routes.rb +0 -43
- data/test/stub/rails_apps/2.3/empty/db/.gitignore +0 -0
- data/test/stub/rails_apps/2.3/empty/db/seeds.rb +0 -7
- data/test/stub/rails_apps/2.3/empty/doc/README_FOR_APP +0 -2
- data/test/stub/rails_apps/2.3/empty/public/404.html +0 -30
- data/test/stub/rails_apps/2.3/empty/public/422.html +0 -30
- data/test/stub/rails_apps/2.3/empty/public/500.html +0 -30
- data/test/stub/rails_apps/2.3/empty/public/favicon.ico +0 -0
- data/test/stub/rails_apps/2.3/empty/public/images/rails.png +0 -0
- data/test/stub/rails_apps/2.3/empty/public/robots.txt +0 -5
- data/test/stub/rails_apps/2.3/empty/public/stylesheets/.gitignore +0 -0
- data/test/stub/rails_apps/2.3/empty/script/about +0 -4
- data/test/stub/rails_apps/2.3/empty/script/console +0 -3
- data/test/stub/rails_apps/2.3/empty/script/dbconsole +0 -3
- data/test/stub/rails_apps/2.3/empty/script/destroy +0 -3
- data/test/stub/rails_apps/2.3/empty/script/generate +0 -3
- data/test/stub/rails_apps/2.3/empty/script/performance/benchmarker +0 -3
- data/test/stub/rails_apps/2.3/empty/script/performance/profiler +0 -3
- data/test/stub/rails_apps/2.3/empty/script/plugin +0 -3
- data/test/stub/rails_apps/2.3/empty/script/runner +0 -3
- data/test/stub/rails_apps/2.3/empty/script/server +0 -3
- data/test/stub/rails_apps/2.3/empty/test/performance/browsing_test.rb +0 -9
- data/test/stub/rails_apps/2.3/empty/test/test_helper.rb +0 -38
- data/test/stub/rails_apps/2.3/mycook/Rakefile +0 -10
- data/test/stub/rails_apps/2.3/mycook/app/helpers/application_helper.rb +0 -3
- data/test/stub/rails_apps/2.3/mycook/config/environments/development.rb +0 -18
- data/test/stub/rails_apps/2.3/mycook/config/initializers/inflections.rb +0 -10
- data/test/stub/rails_apps/2.3/mycook/config/initializers/mime_types.rb +0 -5
- data/test/stub/rails_apps/2.3/mycook/public/404.html +0 -30
- data/test/stub/rails_apps/2.3/mycook/public/422.html +0 -30
- data/test/stub/rails_apps/2.3/mycook/public/500.html +0 -30
- data/test/stub/rails_apps/2.3/mycook/public/favicon.ico +0 -0
- data/test/stub/rails_apps/2.3/mycook/public/images/rails.png +0 -0
- data/test/stub/rails_apps/2.3/mycook/public/robots.txt +0 -5
- data/test/stub/rails_apps/2.3/mycook/public/uploads/.gitignore +0 -0
- data/test/stub/rails_apps/2.3/mycook/script/about +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/console +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/dbconsole +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/destroy +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/generate +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/performance/benchmarker +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/performance/profiler +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/performance/request +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/plugin +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/process/inspector +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/process/reaper +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/process/spawner +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/runner +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/server +0 -3
- 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
|
-
|
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
|
10
|
-
applications on Apache,
|
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
|
1
|
+
<banner>Deploying a web application: an example</banner>
|
2
2
|
|
3
|
-
Suppose you have a
|
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>
|
@@ -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
|
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
|
1
|
+
<banner>Deploying a web application: an example</banner>
|
2
2
|
|
3
|
-
Suppose you have a
|
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
|
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
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
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 %>
|
data/rpm/Vagrantfile
CHANGED
@@ -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->
|
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->
|
237
|
-
ensure(!process->
|
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->
|
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
|
-
|
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
|
705
|
-
//
|
706
|
-
//
|
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
|
-
|
710
|
-
|
711
|
-
|
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
|
-
|
715
|
-
|
746
|
+
session = pool->get(options, &ticket);
|
747
|
+
pid1 = session->getPid();
|
748
|
+
session.reset();
|
716
749
|
|
717
|
-
//
|
750
|
+
// Create a group /bar.
|
718
751
|
options.appRoot = "/bar";
|
719
752
|
SystemTime::force(2);
|
720
|
-
|
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
|
-
//
|
762
|
+
// Get from /foo.
|
723
763
|
options.appRoot = "/foo";
|
724
|
-
|
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
|
-
|
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
|
-
//
|
844
|
+
// Now get from foo again and let the request be queued.
|
845
|
+
options1.noop = false;
|
732
846
|
SystemTime::force(3);
|
733
|
-
|
734
|
-
|
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
|
-
|
738
|
-
|
739
|
-
|
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
|
-
|
743
|
-
|
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, "/"), "
|
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, "/"), "
|
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->
|
57
|
-
ensure(!process->
|
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
|
78
|
-
// and sessionClosed() restores the session
|
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->
|
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->
|
136
|
+
ensure(process->isTotallyBusy());
|
137
137
|
ensure(process->newSession() == NULL);
|
138
138
|
}
|
139
139
|
}
|