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
@@ -139,7 +139,7 @@ private:
|
|
139
139
|
boost::weak_ptr<Group> group;
|
140
140
|
|
141
141
|
/** A subset of 'sockets': all sockets that speak the
|
142
|
-
* "session" protocol, sorted by socket.
|
142
|
+
* "session" protocol, sorted by socket.busyness(). */
|
143
143
|
PriorityQueue<Socket> sessionSockets;
|
144
144
|
|
145
145
|
/** The iterator inside the associated Group's process list. */
|
@@ -181,7 +181,7 @@ private:
|
|
181
181
|
for (it = sockets->begin(); it != sockets->end(); it++) {
|
182
182
|
Socket *socket = &(*it);
|
183
183
|
if (socket->protocol == "session" || socket->protocol == "http_session") {
|
184
|
-
socket->pqHandle = sessionSockets.push(socket, socket->
|
184
|
+
socket->pqHandle = sessionSockets.push(socket, socket->busyness());
|
185
185
|
if (concurrency != -1) {
|
186
186
|
if (socket->concurrency == 0) {
|
187
187
|
// If one of the sockets has a concurrency of
|
@@ -516,13 +516,13 @@ public:
|
|
516
516
|
}
|
517
517
|
}
|
518
518
|
|
519
|
-
int
|
519
|
+
int busyness() const {
|
520
520
|
/* Different processes within a Group may have different
|
521
521
|
* 'concurrency' values. We want:
|
522
522
|
* - Group.pqueue to sort the processes from least used to most used.
|
523
523
|
* - to give processes with concurrency == 0 more priority over processes
|
524
524
|
* with concurrency > 0.
|
525
|
-
* Therefore, we describe our
|
525
|
+
* Therefore, we describe our busyness as a percentage of 'concurrency', with
|
526
526
|
* the percentage value in [0..INT_MAX] instead of [0..1].
|
527
527
|
*/
|
528
528
|
if (concurrency == 0) {
|
@@ -537,26 +537,21 @@ public:
|
|
537
537
|
}
|
538
538
|
}
|
539
539
|
|
540
|
-
// TODO: remove this
|
541
|
-
bool atFullCapacity() const {
|
542
|
-
return atFullUtilization();
|
543
|
-
}
|
544
|
-
|
545
540
|
/**
|
546
541
|
* Whether we've reached the maximum number of concurrent sessions for this
|
547
542
|
* process.
|
548
543
|
*/
|
549
|
-
bool
|
544
|
+
bool isTotallyBusy() const {
|
550
545
|
return concurrency != 0 && sessions >= concurrency;
|
551
546
|
}
|
552
547
|
|
553
548
|
/**
|
554
549
|
* Whether a get() request can be routed to this process, assuming that
|
555
550
|
* the sticky session ID (if any) matches. This is only not the case
|
556
|
-
* if this process is
|
551
|
+
* if this process is totally busy.
|
557
552
|
*/
|
558
553
|
bool canBeRoutedTo() const {
|
559
|
-
return !
|
554
|
+
return !isTotallyBusy();
|
560
555
|
}
|
561
556
|
|
562
557
|
/**
|
@@ -570,12 +565,12 @@ public:
|
|
570
565
|
*/
|
571
566
|
SessionPtr newSession() {
|
572
567
|
Socket *socket = sessionSockets.pop();
|
573
|
-
if (socket->
|
568
|
+
if (socket->isTotallyBusy()) {
|
574
569
|
return SessionPtr();
|
575
570
|
} else {
|
576
571
|
socket->sessions++;
|
577
572
|
this->sessions++;
|
578
|
-
socket->pqHandle = sessionSockets.push(socket, socket->
|
573
|
+
socket->pqHandle = sessionSockets.push(socket, socket->busyness());
|
579
574
|
lastUsed = SystemTime::getUsec();
|
580
575
|
return boost::make_shared<Session>(shared_from_this(), socket);
|
581
576
|
}
|
@@ -590,8 +585,8 @@ public:
|
|
590
585
|
socket->sessions--;
|
591
586
|
this->sessions--;
|
592
587
|
processed++;
|
593
|
-
sessionSockets.decrease(socket->pqHandle, socket->
|
594
|
-
assert(!
|
588
|
+
sessionSockets.decrease(socket->pqHandle, socket->busyness());
|
589
|
+
assert(!isTotallyBusy());
|
595
590
|
}
|
596
591
|
|
597
592
|
/**
|
@@ -611,7 +606,7 @@ public:
|
|
611
606
|
stream << "<connect_password>" << connectPassword << "</connect_password>";
|
612
607
|
stream << "<concurrency>" << concurrency << "</concurrency>";
|
613
608
|
stream << "<sessions>" << sessions << "</sessions>";
|
614
|
-
stream << "<
|
609
|
+
stream << "<busyness>" << busyness() << "</busyness>";
|
615
610
|
stream << "<processed>" << processed << "</processed>";
|
616
611
|
stream << "<spawner_creation_time>" << spawnerCreationTime << "</spawner_creation_time>";
|
617
612
|
stream << "<spawn_start_time>" << spawnStartTime << "</spawn_start_time>";
|
@@ -179,17 +179,17 @@ public:
|
|
179
179
|
}
|
180
180
|
|
181
181
|
|
182
|
-
bool
|
182
|
+
bool isIdle() const {
|
183
183
|
return sessions == 0;
|
184
184
|
}
|
185
185
|
|
186
|
-
int
|
186
|
+
int busyness() const {
|
187
187
|
/* Different sockets within a Process may have different
|
188
188
|
* 'concurrency' values. We want:
|
189
189
|
* - Process.sessionSockets to sort the sockets from least used to most used.
|
190
190
|
* - to give sockets with concurrency == 0 more priority over sockets
|
191
191
|
* with concurrency > 0.
|
192
|
-
* Therefore, we describe our
|
192
|
+
* Therefore, we describe our busyness as a percentage of 'concurrency', with
|
193
193
|
* the percentage value in [0..INT_MAX] instead of [0..1].
|
194
194
|
*/
|
195
195
|
if (concurrency == 0) {
|
@@ -205,7 +205,7 @@ public:
|
|
205
205
|
}
|
206
206
|
}
|
207
207
|
|
208
|
-
bool
|
208
|
+
bool isTotallyBusy() const {
|
209
209
|
return concurrency != 0 && sessions >= concurrency;
|
210
210
|
}
|
211
211
|
};
|
@@ -297,7 +297,8 @@ private:
|
|
297
297
|
Group *group = route(waiter.options);
|
298
298
|
Options adjustedOptions = waiter.options;
|
299
299
|
adjustOptions(adjustedOptions, group);
|
300
|
-
SessionPtr session = group->get(adjustedOptions, waiter.callback
|
300
|
+
SessionPtr session = group->get(adjustedOptions, waiter.callback,
|
301
|
+
postLockActions);
|
301
302
|
if (session != NULL) {
|
302
303
|
postLockActions.push_back(boost::bind(
|
303
304
|
waiter.callback, session, ExceptionPtr()));
|
@@ -573,7 +574,9 @@ public:
|
|
573
574
|
return false;
|
574
575
|
}
|
575
576
|
|
576
|
-
SessionPtr get(const Options &newOptions, const GetCallback &callback
|
577
|
+
SessionPtr get(const Options &newOptions, const GetCallback &callback,
|
578
|
+
vector<Callback> &postLockActions)
|
579
|
+
{
|
577
580
|
switch (state) {
|
578
581
|
case INITIALIZING:
|
579
582
|
getWaitlist.push_back(GetWaiter(newOptions, callback));
|
@@ -589,10 +592,10 @@ public:
|
|
589
592
|
Options adjustedOptions = newOptions;
|
590
593
|
adjustOptions(adjustedOptions, group);
|
591
594
|
verifyInvariants();
|
592
|
-
return group->get(adjustedOptions, callback);
|
595
|
+
return group->get(adjustedOptions, callback, postLockActions);
|
593
596
|
} else {
|
594
597
|
verifyInvariants();
|
595
|
-
return defaultGroup->get(newOptions, callback);
|
598
|
+
return defaultGroup->get(newOptions, callback, postLockActions);
|
596
599
|
}
|
597
600
|
case DESTROYING:
|
598
601
|
case DESTROYED:
|
@@ -618,19 +621,29 @@ public:
|
|
618
621
|
return defaultGroup;
|
619
622
|
}
|
620
623
|
|
621
|
-
unsigned int
|
624
|
+
unsigned int capacityUsed() const {
|
622
625
|
vector<GroupPtr>::const_iterator it, end = groups.end();
|
623
626
|
unsigned int result = 0;
|
624
627
|
|
625
628
|
for (it = groups.begin(); it != end; it++) {
|
626
|
-
result += (*it)->
|
629
|
+
result += (*it)->capacityUsed();
|
627
630
|
}
|
628
631
|
if (state == INITIALIZING || state == RESTARTING) {
|
629
632
|
result++;
|
630
633
|
}
|
631
634
|
return result;
|
632
635
|
}
|
633
|
-
|
636
|
+
|
637
|
+
unsigned int getProcessCount() const {
|
638
|
+
unsigned int result = 0;
|
639
|
+
vector<GroupPtr>::const_iterator g_it, g_end = groups.end();
|
640
|
+
for (g_it = groups.begin(); g_it != g_end; g_it++) {
|
641
|
+
const GroupPtr &group = *g_it;
|
642
|
+
result += group->getProcessCount();
|
643
|
+
}
|
644
|
+
return result;
|
645
|
+
}
|
646
|
+
|
634
647
|
bool needsRestart() const {
|
635
648
|
return false;
|
636
649
|
}
|
@@ -652,16 +665,6 @@ public:
|
|
652
665
|
verifyInvariants();
|
653
666
|
}
|
654
667
|
|
655
|
-
unsigned int getProcessCount() const {
|
656
|
-
unsigned int result = 0;
|
657
|
-
vector<GroupPtr>::const_iterator g_it, g_end = groups.end();
|
658
|
-
for (g_it = groups.begin(); g_it != g_end; g_it++) {
|
659
|
-
const GroupPtr &group = *g_it;
|
660
|
-
result += group->getProcessCount();
|
661
|
-
}
|
662
|
-
return result;
|
663
|
-
}
|
664
|
-
|
665
668
|
string inspect() const {
|
666
669
|
return name;
|
667
670
|
}
|
data/ext/common/Constants.h
CHANGED
@@ -38,6 +38,12 @@
|
|
38
38
|
|
39
39
|
#define APACHE2_DOC_URL "http://www.modrails.com/documentation/Users%20guide%20Apache.html"
|
40
40
|
|
41
|
+
#define DEB_APACHE_MODULE_PACKAGE "libapache2-mod-passenger"
|
42
|
+
|
43
|
+
#define DEB_DEV_PACKAGE "passenger-dev"
|
44
|
+
|
45
|
+
#define DEB_NGINX_PACKAGE "nginx-extras"
|
46
|
+
|
41
47
|
#define DEFAULT_ANALYTICS_LOG_GROUP ""
|
42
48
|
|
43
49
|
#define DEFAULT_ANALYTICS_LOG_PERMISSIONS "u=rwx,g=rx,o=rx"
|
@@ -68,6 +74,8 @@
|
|
68
74
|
|
69
75
|
#define DEFAULT_WEB_APP_USER "nobody"
|
70
76
|
|
77
|
+
#define ENTERPRISE_URL "http://www.phusionpassenger.com/enterprise"
|
78
|
+
|
71
79
|
#define FEEDBACK_FD 3
|
72
80
|
|
73
81
|
#define INDEX_DOC_URL "http://www.modrails.com/documentation/Users%20guide.html"
|
@@ -78,7 +86,7 @@
|
|
78
86
|
|
79
87
|
#define NGINX_DOC_URL "http://www.modrails.com/documentation/Users%20guide%20Nginx.html"
|
80
88
|
|
81
|
-
#define PASSENGER_VERSION "4.0.
|
89
|
+
#define PASSENGER_VERSION "4.0.31"
|
82
90
|
|
83
91
|
#define POOL_HELPER_THREAD_STACK_SIZE 262144
|
84
92
|
|
@@ -88,6 +96,12 @@
|
|
88
96
|
|
89
97
|
#define PROGRAM_NAME "Phusion Passenger"
|
90
98
|
|
99
|
+
#define RPM_APACHE_MODULE_PACKAGE "mod_passenger"
|
100
|
+
|
101
|
+
#define RPM_DEV_PACKAGE "passenger-devel"
|
102
|
+
|
103
|
+
#define RPM_NGINX_PACKAGE "nginx"
|
104
|
+
|
91
105
|
#define SERVER_INSTANCE_DIR_GENERATION_STRUCTURE_MAJOR_VERSION 3
|
92
106
|
|
93
107
|
#define SERVER_INSTANCE_DIR_GENERATION_STRUCTURE_MINOR_VERSION 0
|
data/ext/common/MessageServer.h
CHANGED
@@ -49,6 +49,7 @@
|
|
49
49
|
#include <Utils/StrIntUtils.h>
|
50
50
|
#include <Utils/IOUtils.h>
|
51
51
|
#include <Utils/MessageIO.h>
|
52
|
+
#include <Utils/VariantMap.h>
|
52
53
|
|
53
54
|
namespace Passenger {
|
54
55
|
|
@@ -247,6 +248,27 @@ public:
|
|
247
248
|
return args.size() >= minargs + 1 && args.size() <= maxargs + 1 && args[0] == command;
|
248
249
|
}
|
249
250
|
|
251
|
+
/** Utility function for converting arguments (starting from the given index)
|
252
|
+
* into a VariantMap.
|
253
|
+
*
|
254
|
+
* @throws ArgumentException The number of arguments isn't an even number.
|
255
|
+
*/
|
256
|
+
VariantMap argsToOptions(const vector<string> &args, unsigned int startIndex = 1) const {
|
257
|
+
VariantMap map;
|
258
|
+
vector<string>::const_iterator it = args.begin() + startIndex, end = args.end();
|
259
|
+
while (it != end) {
|
260
|
+
const string &key = *it;
|
261
|
+
it++;
|
262
|
+
if (it == end) {
|
263
|
+
throw ArgumentException("Invalid options");
|
264
|
+
}
|
265
|
+
const string &value = *it;
|
266
|
+
map.set(key, value);
|
267
|
+
it++;
|
268
|
+
}
|
269
|
+
return map;
|
270
|
+
}
|
271
|
+
|
250
272
|
public:
|
251
273
|
virtual ~Handler() { }
|
252
274
|
|
data/ext/common/Utils.cpp
CHANGED
@@ -540,7 +540,10 @@ absolutizePath(const StaticString &path, const StaticString &workingDir) {
|
|
540
540
|
if (!startsWith(path, "/")) {
|
541
541
|
if (workingDir.empty()) {
|
542
542
|
char buffer[PATH_MAX];
|
543
|
-
getcwd(buffer, sizeof(buffer))
|
543
|
+
if (getcwd(buffer, sizeof(buffer)) == NULL) {
|
544
|
+
int e = errno;
|
545
|
+
throw SystemException("Unable to query current working directory", e);
|
546
|
+
}
|
544
547
|
split(buffer + 1, '/', components);
|
545
548
|
} else {
|
546
549
|
string absoluteWorkingDir = absolutizePath(workingDir);
|
data/ext/common/Utils.h
CHANGED
@@ -249,8 +249,10 @@ mode_t parseModeString(const StaticString &mode);
|
|
249
249
|
/**
|
250
250
|
* Turns the given path into an absolute path. Unlike realpath(), this function does
|
251
251
|
* not resolve symlinks.
|
252
|
+
*
|
253
|
+
* @throws SystemException
|
252
254
|
*/
|
253
|
-
string absolutizePath(const StaticString &path, const StaticString &workingDir =
|
255
|
+
string absolutizePath(const StaticString &path, const StaticString &workingDir = StaticString());
|
254
256
|
|
255
257
|
/**
|
256
258
|
* Return the path name for the directory in which the system stores general
|
data/ext/common/Utils/Timer.h
CHANGED
@@ -91,7 +91,21 @@ public:
|
|
91
91
|
startTime.tv_sec = 0;
|
92
92
|
startTime.tv_usec = 0;
|
93
93
|
}
|
94
|
-
|
94
|
+
|
95
|
+
/**
|
96
|
+
* Resets the timer. If the timer was already started then it is still started;
|
97
|
+
* if it was stopped then it is still stopped.
|
98
|
+
*/
|
99
|
+
void reset() {
|
100
|
+
boost::lock_guard<boost::mutex> l(lock);
|
101
|
+
if (startTime.tv_sec != 0 || startTime.tv_usec != 0) {
|
102
|
+
int ret;
|
103
|
+
do {
|
104
|
+
ret = gettimeofday(&startTime, NULL);
|
105
|
+
} while (ret == -1 && errno == EINTR);
|
106
|
+
}
|
107
|
+
}
|
108
|
+
|
95
109
|
/**
|
96
110
|
* Returns the amount of time that has elapsed since the timer was last started,
|
97
111
|
* in miliseconds. If the timer is currently stopped, then 0 is returned.
|
File without changes
|
File without changes
|
File without changes
|
data/ext/common/agents/Base.cpp
CHANGED
@@ -85,6 +85,13 @@ struct AbortHandlerState {
|
|
85
85
|
typedef void (*Callback)(AbortHandlerState &state, void *userData);
|
86
86
|
|
87
87
|
|
88
|
+
#define IGNORE_SYSCALL_RESULT(code) \
|
89
|
+
do { \
|
90
|
+
int _ret = code; \
|
91
|
+
(void) _ret; \
|
92
|
+
} while (false)
|
93
|
+
|
94
|
+
|
88
95
|
static bool _feedbackFdAvailable = false;
|
89
96
|
static const char digits[] = {
|
90
97
|
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'
|
@@ -150,6 +157,15 @@ hasEnvOption(const char *name, bool defaultValue = false) {
|
|
150
157
|
}
|
151
158
|
}
|
152
159
|
|
160
|
+
// When we're in a crash handler, there's nothing we can do if we fail to
|
161
|
+
// write to stderr, so we ignore its return value and we ignore compiler
|
162
|
+
// warnings about ignoring that.
|
163
|
+
static void
|
164
|
+
write_nowarn(int fd, const void *buf, size_t n) {
|
165
|
+
ssize_t ret = write(fd, buf, n);
|
166
|
+
(void) ret;
|
167
|
+
}
|
168
|
+
|
153
169
|
// No idea whether strlen() is async signal safe, but let's not risk it
|
154
170
|
// and write our own version instead that's guaranteed to be safe.
|
155
171
|
static size_t
|
@@ -165,7 +181,7 @@ safeStrlen(const char *str) {
|
|
165
181
|
// Async-signal safe way to print to stderr.
|
166
182
|
static void
|
167
183
|
safePrintErr(const char *message) {
|
168
|
-
|
184
|
+
write_nowarn(STDERR_FILENO, message, strlen(message));
|
169
185
|
}
|
170
186
|
|
171
187
|
// Must be async signal safe.
|
@@ -369,7 +385,7 @@ runInSubprocessWithTimeLimit(AbortHandlerState &state, Callback callback, void *
|
|
369
385
|
end = appendText(end, "Could not create subprocess: pipe() failed with errno=");
|
370
386
|
end = appendULL(end, e);
|
371
387
|
end = appendText(end, "\n");
|
372
|
-
|
388
|
+
write_nowarn(STDERR_FILENO, state.messageBuf, end - state.messageBuf);
|
373
389
|
return -1;
|
374
390
|
}
|
375
391
|
|
@@ -388,7 +404,7 @@ runInSubprocessWithTimeLimit(AbortHandlerState &state, Callback callback, void *
|
|
388
404
|
end = appendText(end, "Could not create subprocess: fork() failed with errno=");
|
389
405
|
end = appendULL(end, e);
|
390
406
|
end = appendText(end, "\n");
|
391
|
-
|
407
|
+
write_nowarn(STDERR_FILENO, state.messageBuf, end - state.messageBuf);
|
392
408
|
return -1;
|
393
409
|
|
394
410
|
} else {
|
@@ -430,7 +446,7 @@ dumpFileDescriptorInfoWithLsof(AbortHandlerState &state, void *userData) {
|
|
430
446
|
end = appendText(end, "ERROR: cannot execute command 'lsof': errno=");
|
431
447
|
end = appendULL(end, errno);
|
432
448
|
end = appendText(end, "\n");
|
433
|
-
|
449
|
+
write_nowarn(STDERR_FILENO, state.messageBuf, end - state.messageBuf);
|
434
450
|
_exit(1);
|
435
451
|
}
|
436
452
|
|
@@ -462,7 +478,7 @@ dumpFileDescriptorInfo(AbortHandlerState &state) {
|
|
462
478
|
end = messageBuf;
|
463
479
|
end = appendText(end, state.messagePrefix);
|
464
480
|
end = appendText(end, " ] Open files and file descriptors:\n");
|
465
|
-
|
481
|
+
write_nowarn(STDERR_FILENO, messageBuf, end - messageBuf);
|
466
482
|
|
467
483
|
status = runInSubprocessWithTimeLimit(state, dumpFileDescriptorInfoWithLsof, NULL, 4000);
|
468
484
|
|
@@ -485,7 +501,7 @@ dumpFileDescriptorInfo(AbortHandlerState &state) {
|
|
485
501
|
} else {
|
486
502
|
end = messageBuf;
|
487
503
|
end = appendText(end, "ERROR: No other file descriptor dumping mechanism on current platform detected.\n");
|
488
|
-
|
504
|
+
write_nowarn(STDERR_FILENO, messageBuf, end - messageBuf);
|
489
505
|
}
|
490
506
|
}
|
491
507
|
}
|
@@ -513,7 +529,7 @@ dumpWithCrashWatch(AbortHandlerState &state) {
|
|
513
529
|
end = appendText(end, "(execlp() returned errno=");
|
514
530
|
end = appendULL(end, e);
|
515
531
|
end = appendText(end, ") Please check your file permissions or something.\n");
|
516
|
-
|
532
|
+
write_nowarn(STDERR_FILENO, messageBuf, end - messageBuf);
|
517
533
|
}
|
518
534
|
_exit(1);
|
519
535
|
|
@@ -523,7 +539,7 @@ dumpWithCrashWatch(AbortHandlerState &state) {
|
|
523
539
|
end = appendText(end, "Could not execute crash-watch: fork() failed with errno=");
|
524
540
|
end = appendULL(end, e);
|
525
541
|
end = appendText(end, "\n");
|
526
|
-
|
542
|
+
write_nowarn(STDERR_FILENO, messageBuf, end - messageBuf);
|
527
543
|
|
528
544
|
} else {
|
529
545
|
waitpid(child, NULL, 0);
|
@@ -542,7 +558,7 @@ dumpWithCrashWatch(AbortHandlerState &state) {
|
|
542
558
|
end = appendText(end, " ] Backtrace with ");
|
543
559
|
end = appendULL(end, (unsigned long long) frames);
|
544
560
|
end = appendText(end, " frames:\n");
|
545
|
-
|
561
|
+
write_nowarn(STDERR_FILENO, state.messageBuf, end - state.messageBuf);
|
546
562
|
|
547
563
|
if (backtraceSanitizerCommand != NULL) {
|
548
564
|
int p[2];
|
@@ -553,7 +569,7 @@ dumpWithCrashWatch(AbortHandlerState &state) {
|
|
553
569
|
end = appendULL(end, e);
|
554
570
|
end = appendText(end, "\n");
|
555
571
|
end = appendText(end, "Falling back to writing to stderr directly...\n");
|
556
|
-
|
572
|
+
write_nowarn(STDERR_FILENO, state.messageBuf, end - state.messageBuf);
|
557
573
|
backtrace_symbols_fd(backtraceStore, frames, STDERR_FILENO);
|
558
574
|
return;
|
559
575
|
}
|
@@ -586,7 +602,7 @@ dumpWithCrashWatch(AbortHandlerState &state) {
|
|
586
602
|
end = appendText(end, "ERROR: cannot execute '");
|
587
603
|
end = appendText(end, backtraceSanitizerCommand);
|
588
604
|
end = appendText(end, "' for sanitizing the backtrace, trying 'cat'...\n");
|
589
|
-
|
605
|
+
write_nowarn(STDERR_FILENO, state.messageBuf, end - state.messageBuf);
|
590
606
|
execlp("cat", "cat", (const char * const) 0);
|
591
607
|
execlp("/bin/cat", "cat", (const char * const) 0);
|
592
608
|
execlp("/usr/bin/cat", "cat", (const char * const) 0);
|
@@ -602,7 +618,7 @@ dumpWithCrashWatch(AbortHandlerState &state) {
|
|
602
618
|
end = appendULL(end, e);
|
603
619
|
end = appendText(end, "\n");
|
604
620
|
end = appendText(end, "Falling back to writing to stderr directly...\n");
|
605
|
-
|
621
|
+
write_nowarn(STDERR_FILENO, state.messageBuf, end - state.messageBuf);
|
606
622
|
backtrace_symbols_fd(backtraceStore, frames, STDERR_FILENO);
|
607
623
|
|
608
624
|
} else {
|
@@ -616,7 +632,7 @@ dumpWithCrashWatch(AbortHandlerState &state) {
|
|
616
632
|
end = appendText(end, "ERROR: cannot execute '");
|
617
633
|
end = appendText(end, backtraceSanitizerCommand);
|
618
634
|
end = appendText(end, "' for sanitizing the backtrace, writing to stderr directly...\n");
|
619
|
-
|
635
|
+
write_nowarn(STDERR_FILENO, state.messageBuf, end - state.messageBuf);
|
620
636
|
backtrace_symbols_fd(backtraceStore, frames, STDERR_FILENO);
|
621
637
|
}
|
622
638
|
}
|
@@ -643,7 +659,7 @@ dumpDiagnostics(AbortHandlerState &state) {
|
|
643
659
|
end = messageBuf;
|
644
660
|
end = appendText(end, state.messagePrefix);
|
645
661
|
end = appendText(end, " ] Date, uname and ulimits:\n");
|
646
|
-
|
662
|
+
write_nowarn(STDERR_FILENO, messageBuf, end - messageBuf);
|
647
663
|
|
648
664
|
// Dump human-readable time string and string.
|
649
665
|
pid = asyncFork();
|
@@ -686,7 +702,7 @@ dumpDiagnostics(AbortHandlerState &state) {
|
|
686
702
|
end = messageBuf;
|
687
703
|
end = appendText(end, state.messagePrefix);
|
688
704
|
end = appendText(end, " ] Phusion Passenger version: " PASSENGER_VERSION "\n");
|
689
|
-
|
705
|
+
write_nowarn(STDERR_FILENO, messageBuf, end - messageBuf);
|
690
706
|
|
691
707
|
if (lastAssertionFailure.filename != NULL) {
|
692
708
|
end = messageBuf;
|
@@ -704,7 +720,7 @@ dumpDiagnostics(AbortHandlerState &state) {
|
|
704
720
|
end = appendText(end, ", line ");
|
705
721
|
end = appendULL(end, lastAssertionFailure.line);
|
706
722
|
end = appendText(end, ".\n");
|
707
|
-
|
723
|
+
write_nowarn(STDERR_FILENO, messageBuf, end - messageBuf);
|
708
724
|
}
|
709
725
|
|
710
726
|
// It is important that writing the message and the backtrace are two
|
@@ -717,7 +733,7 @@ dumpDiagnostics(AbortHandlerState &state) {
|
|
717
733
|
#else
|
718
734
|
end = appendText(end, " ] libc backtrace not available.\n");
|
719
735
|
#endif
|
720
|
-
|
736
|
+
write_nowarn(STDERR_FILENO, messageBuf, end - messageBuf);
|
721
737
|
|
722
738
|
#ifdef LIBC_HAS_BACKTRACE_FUNC
|
723
739
|
runInSubprocessWithTimeLimit(state, dumpBacktrace, NULL, 4000);
|
@@ -729,7 +745,7 @@ dumpDiagnostics(AbortHandlerState &state) {
|
|
729
745
|
end = messageBuf;
|
730
746
|
end = appendText(end, state.messagePrefix);
|
731
747
|
end = appendText(end, " ] Dumping additional diagnostical information...\n");
|
732
|
-
|
748
|
+
write_nowarn(STDERR_FILENO, messageBuf, end - messageBuf);
|
733
749
|
safePrintErr("--------------------------------------\n");
|
734
750
|
runInSubprocessWithTimeLimit(state, runCustomDiagnosticsDumper, NULL, 2000);
|
735
751
|
safePrintErr("--------------------------------------\n");
|
@@ -746,10 +762,10 @@ dumpDiagnostics(AbortHandlerState &state) {
|
|
746
762
|
#else
|
747
763
|
end = appendText(end, " ] Dumping a backtrace with crash-watch...\n");
|
748
764
|
#endif
|
749
|
-
|
765
|
+
write_nowarn(STDERR_FILENO, messageBuf, end - messageBuf);
|
750
766
|
dumpWithCrashWatch(state);
|
751
767
|
} else {
|
752
|
-
|
768
|
+
write_nowarn(STDERR_FILENO, "\n", 1);
|
753
769
|
}
|
754
770
|
}
|
755
771
|
|
@@ -836,7 +852,7 @@ abortHandler(int signo, siginfo_t *info, void *ctx) {
|
|
836
852
|
end = appendText(end, ", reason=");
|
837
853
|
end = appendSignalReason(end, state.info);
|
838
854
|
end = appendText(end, "\n");
|
839
|
-
|
855
|
+
write_nowarn(STDERR_FILENO, state.messageBuf, end - state.messageBuf);
|
840
856
|
// Run default signal handler.
|
841
857
|
raise(signo);
|
842
858
|
} else {
|
@@ -847,16 +863,24 @@ abortHandler(int signo, siginfo_t *info, void *ctx) {
|
|
847
863
|
end = appendText(end, ", reason=");
|
848
864
|
end = appendSignalReason(end, state.info);
|
849
865
|
end = appendText(end, "\n");
|
850
|
-
|
866
|
+
write_nowarn(STDERR_FILENO, state.messageBuf, end - state.messageBuf);
|
851
867
|
_exit(1);
|
852
868
|
}
|
853
869
|
return;
|
854
870
|
}
|
855
871
|
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
872
|
+
if (emergencyPipe1[0] != -1) {
|
873
|
+
close(emergencyPipe1[0]);
|
874
|
+
}
|
875
|
+
if (emergencyPipe1[1] != -1) {
|
876
|
+
close(emergencyPipe1[1]);
|
877
|
+
}
|
878
|
+
if (emergencyPipe2[0] != -1) {
|
879
|
+
close(emergencyPipe2[0]);
|
880
|
+
}
|
881
|
+
if (emergencyPipe2[1] != -1) {
|
882
|
+
close(emergencyPipe2[1]);
|
883
|
+
}
|
860
884
|
emergencyPipe1[0] = emergencyPipe1[1] = -1;
|
861
885
|
emergencyPipe2[0] = emergencyPipe2[1] = -1;
|
862
886
|
|
@@ -883,7 +907,7 @@ abortHandler(int signo, siginfo_t *info, void *ctx) {
|
|
883
907
|
end = appendText(end, ", randomSeed=");
|
884
908
|
end = appendULL(end, (unsigned long long) randomSeed);
|
885
909
|
end = appendText(end, "\n");
|
886
|
-
|
910
|
+
write_nowarn(STDERR_FILENO, state.messageBuf, end - state.messageBuf);
|
887
911
|
|
888
912
|
end = state.messageBuf;
|
889
913
|
if (*crashLogFile != '\0') {
|
@@ -895,13 +919,13 @@ abortHandler(int signo, siginfo_t *info, void *ctx) {
|
|
895
919
|
end = appendText(end, state.messagePrefix);
|
896
920
|
end = appendText(end, " ] Could not create crash log file, so dumping to stderr only.\n");
|
897
921
|
}
|
898
|
-
|
922
|
+
write_nowarn(STDERR_FILENO, state.messageBuf, end - state.messageBuf);
|
899
923
|
|
900
924
|
if (beepOnAbort) {
|
901
925
|
end = state.messageBuf;
|
902
926
|
end = appendText(end, state.messagePrefix);
|
903
927
|
end = appendText(end, " ] PASSENGER_BEEP_ON_ABORT on, executing beep...\n");
|
904
|
-
|
928
|
+
write_nowarn(STDERR_FILENO, state.messageBuf, end - state.messageBuf);
|
905
929
|
|
906
930
|
child = asyncFork();
|
907
931
|
if (child == 0) {
|
@@ -922,7 +946,7 @@ abortHandler(int signo, siginfo_t *info, void *ctx) {
|
|
922
946
|
end = appendText(end, " ] Could fork a child process for invoking a beep: fork() failed with errno=");
|
923
947
|
end = appendULL(end, e);
|
924
948
|
end = appendText(end, "\n");
|
925
|
-
|
949
|
+
write_nowarn(STDERR_FILENO, state.messageBuf, end - state.messageBuf);
|
926
950
|
}
|
927
951
|
}
|
928
952
|
|
@@ -930,7 +954,7 @@ abortHandler(int signo, siginfo_t *info, void *ctx) {
|
|
930
954
|
end = state.messageBuf;
|
931
955
|
end = appendText(end, state.messagePrefix);
|
932
956
|
end = appendText(end, " ] PASSENGER_STOP_ON_ABORT on, so process stopped. Send SIGCONT when you want to continue.\n");
|
933
|
-
|
957
|
+
write_nowarn(STDERR_FILENO, state.messageBuf, end - state.messageBuf);
|
934
958
|
raise(SIGSTOP);
|
935
959
|
}
|
936
960
|
|
@@ -970,7 +994,7 @@ abortHandler(int signo, siginfo_t *info, void *ctx) {
|
|
970
994
|
end = appendText(end, "] Could fork a child process for dumping diagnostics: fork() failed with errno=");
|
971
995
|
end = appendULL(end, e);
|
972
996
|
end = appendText(end, "\n");
|
973
|
-
|
997
|
+
write_nowarn(STDERR_FILENO, state.messageBuf, end - state.messageBuf);
|
974
998
|
_exit(1);
|
975
999
|
|
976
1000
|
} else {
|
@@ -985,7 +1009,7 @@ abortHandler(int signo, siginfo_t *info, void *ctx) {
|
|
985
1009
|
end = appendText(end, " ] Could fork a child process for dumping diagnostics: fork() failed with errno=");
|
986
1010
|
end = appendULL(end, e);
|
987
1011
|
end = appendText(end, "\n");
|
988
|
-
|
1012
|
+
write_nowarn(STDERR_FILENO, state.messageBuf, end - state.messageBuf);
|
989
1013
|
|
990
1014
|
} else {
|
991
1015
|
raise(SIGSTOP);
|
@@ -1477,8 +1501,8 @@ initializeAgent(int argc, char *argv[], const char *processName) {
|
|
1477
1501
|
shouldDumpWithCrashWatch = hasEnvOption("PASSENGER_DUMP_WITH_CRASH_WATCH", true);
|
1478
1502
|
beepOnAbort = hasEnvOption("PASSENGER_BEEP_ON_ABORT", false);
|
1479
1503
|
stopOnAbort = hasEnvOption("PASSENGER_STOP_ON_ABORT", false);
|
1480
|
-
pipe(emergencyPipe1);
|
1481
|
-
pipe(emergencyPipe2);
|
1504
|
+
IGNORE_SYSCALL_RESULT(pipe(emergencyPipe1));
|
1505
|
+
IGNORE_SYSCALL_RESULT(pipe(emergencyPipe2));
|
1482
1506
|
installAbortHandler();
|
1483
1507
|
}
|
1484
1508
|
oxt::initialize();
|