passenger 2.1.3 → 2.2.0
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/DEVELOPERS.TXT +2 -0
- data/INSTALL +3 -1
- data/LICENSE +19 -355
- data/NEWS +3 -0
- data/README +11 -4
- data/Rakefile +435 -236
- data/bin/passenger-config +20 -14
- data/bin/passenger-install-apache2-module +67 -201
- data/bin/passenger-install-nginx-module +477 -0
- data/bin/passenger-make-enterprisey +17 -12
- data/bin/passenger-memory-stats +33 -23
- data/bin/passenger-spawn-server +17 -12
- data/bin/passenger-status +18 -13
- data/bin/passenger-stress-test +17 -12
- data/doc/{Users guide.html → Users guide Apache.html } +79 -61
- data/doc/{Users guide.txt → Users guide Apache.txt } +43 -939
- data/doc/Users guide Nginx.html +2276 -0
- data/doc/Users guide Nginx.txt +776 -0
- data/doc/cxxapi/ApplicationPoolServer_8h-source.html +9 -4
- data/doc/cxxapi/ApplicationPool_8h-source.html +9 -4
- data/doc/cxxapi/Application_8h-source.html +26 -21
- data/doc/cxxapi/Bucket_8h-source.html +54 -44
- data/doc/cxxapi/CachedFileStat_8h-source.html +9 -4
- data/doc/cxxapi/Configuration_8h-source.html +357 -339
- data/doc/cxxapi/DirectoryMapper_8h-source.html +294 -280
- data/doc/cxxapi/DummySpawnManager_8h-source.html +9 -4
- data/doc/cxxapi/Exceptions_8h-source.html +9 -4
- data/doc/cxxapi/FileChecker_8h-source.html +9 -4
- data/doc/cxxapi/Hooks_8h-source.html +50 -40
- data/doc/cxxapi/Logging_8h-source.html +9 -4
- data/doc/cxxapi/MessageChannel_8h-source.html +20 -15
- data/doc/cxxapi/PoolOptions_8h-source.html +10 -5
- data/doc/cxxapi/SpawnManager_8h-source.html +9 -4
- data/doc/cxxapi/StandardApplicationPool_8h-source.html +10 -5
- data/doc/cxxapi/SystemTime_8h-source.html +9 -4
- data/doc/cxxapi/Utils_8h-source.html +242 -214
- data/doc/cxxapi/annotated.html +4 -28
- data/doc/cxxapi/classClient-members.html +4 -4
- data/doc/cxxapi/classClient.html +14 -11
- data/doc/cxxapi/classHooks-members.html +4 -5
- data/doc/cxxapi/classHooks.html +26 -24
- data/doc/cxxapi/classPassenger_1_1Application-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1Application.html +40 -37
- data/doc/cxxapi/classPassenger_1_1ApplicationPool-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1ApplicationPool.html +95 -92
- data/doc/cxxapi/classPassenger_1_1ApplicationPoolServer-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1ApplicationPoolServer.html +26 -23
- data/doc/cxxapi/classPassenger_1_1ApplicationPool__inherit__graph.map +1 -1
- data/doc/cxxapi/classPassenger_1_1ApplicationPool__inherit__graph.md5 +1 -1
- data/doc/cxxapi/classPassenger_1_1ApplicationPool__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1Application_1_1Session-members.html +17 -17
- data/doc/cxxapi/classPassenger_1_1Application_1_1Session.html +139 -136
- data/doc/cxxapi/classPassenger_1_1BufferedUpload-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1BufferedUpload.html +13 -10
- data/doc/cxxapi/classPassenger_1_1BusyException-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1BusyException.html +11 -8
- data/doc/cxxapi/classPassenger_1_1ConfigurationException-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1ConfigurationException.html +11 -8
- data/doc/cxxapi/classPassenger_1_1DirectoryMapper-members.html +4 -5
- data/doc/cxxapi/classPassenger_1_1DirectoryMapper.html +45 -43
- data/doc/cxxapi/classPassenger_1_1DummySpawnManager-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1DummySpawnManager.html +13 -10
- data/doc/cxxapi/classPassenger_1_1FileChecker-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1FileChecker.html +22 -19
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException.html +12 -9
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException__inherit__graph.map +1 -1
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException__inherit__graph.md5 +1 -1
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1FileSystemException-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1FileSystemException.html +14 -11
- data/doc/cxxapi/classPassenger_1_1FileSystemException__inherit__graph.map +1 -1
- data/doc/cxxapi/classPassenger_1_1FileSystemException__inherit__graph.md5 +1 -1
- data/doc/cxxapi/classPassenger_1_1FileSystemException__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1IOException-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1IOException.html +12 -9
- data/doc/cxxapi/classPassenger_1_1IOException__inherit__graph.map +1 -1
- data/doc/cxxapi/classPassenger_1_1IOException__inherit__graph.md5 +1 -1
- data/doc/cxxapi/classPassenger_1_1IOException__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1MessageChannel-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1MessageChannel.html +228 -225
- data/doc/cxxapi/classPassenger_1_1RuntimeException-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1RuntimeException.html +11 -8
- data/doc/cxxapi/classPassenger_1_1SpawnException-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1SpawnException.html +14 -11
- data/doc/cxxapi/classPassenger_1_1SpawnManager-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1SpawnManager.html +50 -47
- data/doc/cxxapi/classPassenger_1_1StandardApplicationPool-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1StandardApplicationPool.html +73 -70
- data/doc/cxxapi/classPassenger_1_1StandardApplicationPool__inherit__graph.map +1 -1
- data/doc/cxxapi/classPassenger_1_1StandardApplicationPool__inherit__graph.md5 +1 -1
- data/doc/cxxapi/classPassenger_1_1StandardApplicationPool__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1SystemException-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1SystemException.html +17 -14
- data/doc/cxxapi/classPassenger_1_1SystemException__inherit__graph.map +1 -1
- data/doc/cxxapi/classPassenger_1_1SystemException__inherit__graph.md5 +1 -1
- data/doc/cxxapi/classPassenger_1_1SystemException__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1SystemTime-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1SystemTime.html +14 -11
- data/doc/cxxapi/classes.html +35 -0
- data/doc/cxxapi/definitions_8h-source.html +9 -4
- data/doc/cxxapi/doxygen.css +311 -303
- data/doc/cxxapi/files.html +9 -18
- data/doc/cxxapi/functions.html +5 -224
- data/doc/cxxapi/functions_func.html +5 -185
- data/doc/cxxapi/functions_type.html +4 -4
- data/doc/cxxapi/functions_vars.html +4 -4
- data/doc/cxxapi/graph_legend.dot +19 -19
- data/doc/cxxapi/graph_legend.html +5 -5
- data/doc/cxxapi/graph_legend.png +0 -0
- data/doc/cxxapi/group__Configuration.html +11 -13
- data/doc/cxxapi/group__Configuration.png +0 -0
- data/doc/cxxapi/group__Core.html +10 -12
- data/doc/cxxapi/group__Core.png +0 -0
- data/doc/cxxapi/group__Exceptions.html +5 -7
- data/doc/cxxapi/group__Hooks.html +5 -7
- data/doc/cxxapi/group__Hooks.png +0 -0
- data/doc/cxxapi/group__Support.html +5 -624
- data/doc/cxxapi/hierarchy.html +6 -6
- data/doc/cxxapi/inherit__graph__0.map +1 -1
- data/doc/cxxapi/inherit__graph__0.md5 +1 -1
- data/doc/cxxapi/inherit__graph__0.png +0 -0
- data/doc/cxxapi/inherit__graph__1.map +1 -1
- data/doc/cxxapi/inherit__graph__1.md5 +1 -1
- data/doc/cxxapi/inherit__graph__1.png +0 -0
- data/doc/cxxapi/inherit__graph__10.map +1 -1
- data/doc/cxxapi/inherit__graph__10.md5 +1 -1
- data/doc/cxxapi/inherit__graph__10.png +0 -0
- data/doc/cxxapi/inherit__graph__11.map +1 -1
- data/doc/cxxapi/inherit__graph__11.md5 +1 -1
- data/doc/cxxapi/inherit__graph__11.png +0 -0
- data/doc/cxxapi/inherit__graph__12.map +1 -1
- data/doc/cxxapi/inherit__graph__12.md5 +1 -1
- data/doc/cxxapi/inherit__graph__12.png +0 -0
- data/doc/cxxapi/inherit__graph__13.map +1 -2
- data/doc/cxxapi/inherit__graph__13.md5 +1 -1
- data/doc/cxxapi/inherit__graph__13.png +0 -0
- data/doc/cxxapi/inherit__graph__14.map +2 -1
- data/doc/cxxapi/inherit__graph__14.md5 +1 -1
- data/doc/cxxapi/inherit__graph__14.png +0 -0
- data/doc/cxxapi/inherit__graph__15.map +1 -1
- data/doc/cxxapi/inherit__graph__15.md5 +1 -1
- data/doc/cxxapi/inherit__graph__15.png +0 -0
- data/doc/cxxapi/inherit__graph__16.map +1 -1
- data/doc/cxxapi/inherit__graph__16.md5 +1 -1
- data/doc/cxxapi/inherit__graph__16.png +0 -0
- data/doc/cxxapi/inherit__graph__17.map +1 -1
- data/doc/cxxapi/inherit__graph__17.md5 +1 -1
- data/doc/cxxapi/inherit__graph__17.png +0 -0
- data/doc/cxxapi/inherit__graph__18.map +1 -1
- data/doc/cxxapi/inherit__graph__18.md5 +1 -1
- data/doc/cxxapi/inherit__graph__18.png +0 -0
- data/doc/cxxapi/inherit__graph__19.map +1 -1
- data/doc/cxxapi/inherit__graph__19.md5 +1 -1
- data/doc/cxxapi/inherit__graph__19.png +0 -0
- data/doc/cxxapi/inherit__graph__2.map +1 -1
- data/doc/cxxapi/inherit__graph__2.md5 +1 -1
- data/doc/cxxapi/inherit__graph__2.png +0 -0
- data/doc/cxxapi/inherit__graph__20.map +2 -2
- data/doc/cxxapi/inherit__graph__20.md5 +1 -1
- data/doc/cxxapi/inherit__graph__20.png +0 -0
- data/doc/cxxapi/inherit__graph__21.map +1 -1
- data/doc/cxxapi/inherit__graph__21.md5 +1 -1
- data/doc/cxxapi/inherit__graph__21.png +0 -0
- data/doc/cxxapi/inherit__graph__3.map +1 -1
- data/doc/cxxapi/inherit__graph__3.md5 +1 -1
- data/doc/cxxapi/inherit__graph__3.png +0 -0
- data/doc/cxxapi/inherit__graph__4.map +1 -1
- data/doc/cxxapi/inherit__graph__4.md5 +1 -1
- data/doc/cxxapi/inherit__graph__4.png +0 -0
- data/doc/cxxapi/inherit__graph__5.map +1 -2
- data/doc/cxxapi/inherit__graph__5.md5 +1 -1
- data/doc/cxxapi/inherit__graph__5.png +0 -0
- data/doc/cxxapi/inherit__graph__6.map +2 -1
- data/doc/cxxapi/inherit__graph__6.md5 +1 -1
- data/doc/cxxapi/inherit__graph__6.png +0 -0
- data/doc/cxxapi/inherit__graph__7.map +1 -1
- data/doc/cxxapi/inherit__graph__7.md5 +1 -1
- data/doc/cxxapi/inherit__graph__7.png +0 -0
- data/doc/cxxapi/inherit__graph__8.map +1 -1
- data/doc/cxxapi/inherit__graph__8.md5 +1 -1
- data/doc/cxxapi/inherit__graph__8.png +0 -0
- data/doc/cxxapi/inherit__graph__9.map +1 -1
- data/doc/cxxapi/inherit__graph__9.md5 +1 -1
- data/doc/cxxapi/inherit__graph__9.png +0 -0
- data/doc/cxxapi/inherits.html +41 -41
- data/doc/cxxapi/main.html +4 -4
- data/doc/cxxapi/modules.html +4 -5
- data/doc/cxxapi/structPassenger_1_1AnythingToString-members.html +4 -4
- data/doc/cxxapi/structPassenger_1_1AnythingToString.html +13 -10
- data/doc/cxxapi/structPassenger_1_1AnythingToString_3_01vector_3_01string_01_4_01_4-members.html +5 -5
- data/doc/cxxapi/structPassenger_1_1AnythingToString_3_01vector_3_01string_01_4_01_4.html +16 -13
- data/doc/cxxapi/structPassenger_1_1PoolOptions-members.html +4 -4
- data/doc/cxxapi/structPassenger_1_1PoolOptions.html +63 -60
- data/doc/cxxapi/tabs.css +5 -2
- data/doc/cxxapi/tree.html +7 -81
- data/doc/rdoc/classes/ConditionVariable.html +59 -59
- data/doc/rdoc/classes/Exception.html +11 -11
- data/doc/rdoc/classes/GC.html +4 -4
- data/doc/rdoc/classes/IO.html +14 -14
- data/doc/rdoc/classes/PhusionPassenger.html +75 -20
- data/doc/rdoc/classes/PhusionPassenger/AbstractInstaller.html +153 -0
- data/doc/rdoc/classes/PhusionPassenger/AbstractRequestHandler.html +125 -130
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer.html +236 -236
- data/doc/rdoc/classes/PhusionPassenger/AbstractServerCollection.html +213 -213
- data/doc/rdoc/classes/PhusionPassenger/AdminTools.html +28 -28
- data/doc/rdoc/classes/PhusionPassenger/AdminTools/ControlProcess.html +91 -75
- data/doc/rdoc/classes/PhusionPassenger/AppInitError.html +10 -10
- data/doc/rdoc/classes/PhusionPassenger/Application.html +64 -64
- data/doc/rdoc/classes/PhusionPassenger/ConsoleTextTemplate.html +34 -34
- data/doc/rdoc/classes/PhusionPassenger/FrameworkInitError.html +13 -13
- data/doc/rdoc/classes/PhusionPassenger/HTMLTemplate.html +30 -30
- data/doc/rdoc/classes/PhusionPassenger/InitializationError.html +10 -10
- data/doc/rdoc/classes/PhusionPassenger/MessageChannel.html +136 -136
- data/doc/rdoc/classes/PhusionPassenger/NativeSupport.html +24 -24
- data/doc/rdoc/classes/PhusionPassenger/Rack/ApplicationSpawner.html +42 -42
- data/doc/rdoc/classes/PhusionPassenger/Rack/RequestHandler.html +55 -53
- data/doc/rdoc/classes/PhusionPassenger/Railz.html +1 -1
- data/doc/rdoc/classes/PhusionPassenger/Railz/ApplicationSpawner.html +25 -30
- data/doc/rdoc/classes/PhusionPassenger/Railz/CGIFixed.html +23 -23
- data/doc/rdoc/classes/PhusionPassenger/Railz/FrameworkSpawner.html +116 -117
- data/doc/rdoc/classes/PhusionPassenger/Railz/RequestHandler.html +22 -22
- data/doc/rdoc/classes/PhusionPassenger/SpawnManager.html +118 -124
- data/doc/rdoc/classes/PhusionPassenger/UnknownError.html +10 -10
- data/doc/rdoc/classes/PhusionPassenger/Utils.html +354 -354
- data/doc/rdoc/classes/PhusionPassenger/VersionNotFound.html +9 -9
- data/doc/rdoc/classes/PhusionPassenger/WSGI/ApplicationSpawner.html +37 -37
- data/doc/rdoc/classes/PlatformInfo.html +282 -261
- data/doc/rdoc/classes/RakeExtensions.html +7 -7
- data/doc/rdoc/classes/Signal.html +26 -26
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/DEVELOPERS_TXT.html +6 -1
- data/doc/rdoc/files/README.html +15 -6
- data/doc/rdoc/files/ext/phusion_passenger/native_support_c.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/abstract_installer_rb.html +129 -0
- data/doc/rdoc/files/lib/phusion_passenger/abstract_request_handler_rb.html +20 -13
- data/doc/rdoc/files/lib/phusion_passenger/abstract_server_collection_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/abstract_server_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/admin_tools/control_process_rb.html +31 -1
- data/doc/rdoc/files/lib/phusion_passenger/admin_tools_rb.html +31 -1
- data/doc/rdoc/files/lib/phusion_passenger/application_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/console_text_template_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/constants_rb.html +21 -12
- data/doc/rdoc/files/lib/phusion_passenger/dependencies_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/events_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/exceptions_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/html_template_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/message_channel_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/packaging_rb.html +122 -0
- data/doc/rdoc/files/lib/phusion_passenger/platform_info_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/rack/application_spawner_rb.html +22 -12
- data/doc/rdoc/files/lib/phusion_passenger/rack/request_handler_rb.html +21 -12
- data/doc/rdoc/files/lib/phusion_passenger/railz/application_spawner_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/railz/cgi_fixed_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/railz/framework_spawner_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/railz/request_handler_rb.html +21 -12
- data/doc/rdoc/files/lib/phusion_passenger/simple_benchmarking_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/spawn_manager_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/utils_rb.html +27 -21
- data/doc/rdoc/files/lib/phusion_passenger/wsgi/application_spawner_rb.html +21 -12
- data/doc/rdoc/files/misc/rake/extensions_rb.html +21 -12
- data/doc/rdoc/fr_class_index.html +1 -0
- data/doc/rdoc/fr_file_index.html +2 -0
- data/doc/rdoc/fr_method_index.html +116 -112
- data/doc/users_guide_snippets/analysis_and_system_maintenance_tools.txt +144 -0
- data/doc/users_guide_snippets/appendix_a_about.txt +13 -0
- data/doc/users_guide_snippets/appendix_b_terminology.txt +63 -0
- data/doc/users_guide_snippets/appendix_c_spawning_methods.txt +304 -0
- data/doc/users_guide_snippets/global_queueing_explained.txt +78 -0
- data/doc/users_guide_snippets/rackup_specifications.txt +75 -0
- data/doc/users_guide_snippets/rails_spawn_method.txt +48 -0
- data/doc/users_guide_snippets/tips.txt +173 -0
- data/ext/apache2/Bucket.cpp +17 -12
- data/ext/apache2/Bucket.h +17 -12
- data/ext/apache2/Configuration.cpp +17 -12
- data/ext/apache2/Configuration.h +27 -14
- data/ext/apache2/DirectoryMapper.h +21 -12
- data/ext/apache2/Hooks.cpp +67 -21
- data/ext/apache2/Hooks.h +17 -12
- data/ext/apache2/mod_passenger.c +17 -12
- data/ext/{apache2 → common}/Application.h +19 -14
- data/ext/{apache2 → common}/ApplicationPool.h +17 -12
- data/ext/{apache2 → common}/ApplicationPoolServer.h +18 -72
- data/ext/{apache2 → common}/ApplicationPoolServerExecutable.cpp +45 -104
- data/ext/common/ApplicationPoolStatusReporter.h +212 -0
- data/ext/{apache2 → common}/CachedFileStat.cpp +17 -12
- data/ext/{apache2 → common}/CachedFileStat.h +17 -12
- data/ext/{apache2 → common}/DummySpawnManager.h +17 -12
- data/ext/{apache2 → common}/Exceptions.h +17 -12
- data/ext/{apache2 → common}/FileChecker.h +17 -12
- data/ext/common/Logging.cpp +65 -0
- data/ext/{apache2 → common}/Logging.h +17 -12
- data/ext/{apache2 → common}/MessageChannel.h +17 -12
- data/ext/{apache2 → common}/PoolOptions.h +17 -12
- data/ext/{apache2 → common}/SpawnManager.h +17 -12
- data/ext/{apache2 → common}/StandardApplicationPool.h +17 -12
- data/ext/common/StaticString.h +147 -0
- data/ext/common/SystemTime.cpp +33 -0
- data/ext/{apache2 → common}/SystemTime.h +17 -12
- data/ext/{apache2 → common}/Utils.cpp +69 -12
- data/ext/{apache2 → common}/Utils.h +41 -12
- data/ext/nginx/Configuration.c +1091 -0
- data/ext/nginx/Configuration.h +71 -0
- data/ext/nginx/ContentHandler.c +1154 -0
- data/ext/nginx/ContentHandler.h +64 -0
- data/ext/nginx/HelperServer.cpp +857 -0
- data/ext/nginx/HttpStatusExtractor.h +161 -0
- data/ext/nginx/ScgiRequestParser.h +317 -0
- data/ext/nginx/StaticContentHandler.c +222 -0
- data/ext/nginx/StaticContentHandler.h +37 -0
- data/ext/nginx/config +41 -0
- data/ext/nginx/ngx_http_passenger_module.c +572 -0
- data/ext/nginx/ngx_http_passenger_module.h +72 -0
- data/ext/oxt/backtrace.cpp +8 -1
- data/ext/oxt/system_calls.cpp +40 -0
- data/ext/oxt/system_calls.hpp +14 -7
- data/ext/phusion_passenger/extconf.rb +17 -12
- data/ext/phusion_passenger/native_support.c +19 -12
- data/lib/phusion_passenger/abstract_installer.rb +196 -0
- data/lib/phusion_passenger/abstract_request_handler.rb +19 -24
- data/lib/phusion_passenger/abstract_server.rb +17 -12
- data/lib/phusion_passenger/abstract_server_collection.rb +17 -12
- data/lib/phusion_passenger/admin_tools.rb +23 -0
- data/lib/phusion_passenger/admin_tools/control_process.rb +39 -13
- data/lib/phusion_passenger/application.rb +17 -12
- data/lib/phusion_passenger/console_text_template.rb +17 -12
- data/lib/phusion_passenger/constants.rb +22 -11
- data/lib/phusion_passenger/dependencies.rb +47 -12
- data/lib/phusion_passenger/events.rb +17 -12
- data/lib/phusion_passenger/exceptions.rb +17 -12
- data/lib/phusion_passenger/html_template.rb +17 -12
- data/lib/phusion_passenger/message_channel.rb +17 -12
- data/lib/phusion_passenger/packaging.rb +39 -0
- data/lib/phusion_passenger/platform_info.rb +48 -22
- data/lib/phusion_passenger/rack/application_spawner.rb +22 -11
- data/lib/phusion_passenger/rack/request_handler.rb +21 -12
- data/lib/phusion_passenger/railz/application_spawner.rb +23 -23
- data/lib/phusion_passenger/railz/framework_spawner.rb +18 -14
- data/lib/phusion_passenger/railz/request_handler.rb +18 -11
- data/lib/phusion_passenger/simple_benchmarking.rb +17 -12
- data/lib/phusion_passenger/spawn_manager.rb +17 -20
- data/lib/phusion_passenger/templates/{apache_must_be_compiled_with_compatible_mpm.txt.erb → apache2/apache_must_be_compiled_with_compatible_mpm.txt.erb} +0 -0
- data/lib/phusion_passenger/templates/{apache2_config_snippets.txt.erb → apache2/config_snippets.txt.erb} +0 -0
- data/lib/phusion_passenger/templates/{deployment_example.txt.erb → apache2/deployment_example.txt.erb} +0 -0
- data/lib/phusion_passenger/templates/{no_write_permission_to_passenger_root.txt.erb → apache2/no_write_permission_to_passenger_root.txt.erb} +0 -0
- data/lib/phusion_passenger/templates/{possible_solutions_for_compilation_and_installation_problems.txt.erb → apache2/possible_solutions_for_compilation_and_installation_problems.txt.erb} +0 -0
- data/lib/phusion_passenger/templates/{run_installer_as_root.txt.erb → apache2/run_installer_as_root.txt.erb} +0 -0
- data/lib/phusion_passenger/templates/{welcome.txt.erb → apache2/welcome.txt.erb} +0 -0
- data/lib/phusion_passenger/templates/nginx/ask_for_extra_configure_flags.txt.erb +8 -0
- data/lib/phusion_passenger/templates/nginx/cannot_write_to_dir.txt.erb +11 -0
- data/lib/phusion_passenger/templates/nginx/config_snippets.txt.erb +17 -0
- data/lib/phusion_passenger/templates/nginx/config_snippets_inserted.txt.erb +20 -0
- data/lib/phusion_passenger/templates/nginx/confirm_extra_configure_flags.txt.erb +5 -0
- data/lib/phusion_passenger/templates/nginx/deployment_example.txt.erb +22 -0
- data/lib/phusion_passenger/templates/nginx/pcre_could_not_be_downloaded.txt.erb +11 -0
- data/lib/phusion_passenger/templates/nginx/pcre_could_not_be_extracted.txt.erb +11 -0
- data/lib/phusion_passenger/templates/nginx/possible_solutions_for_compilation_and_installation_problems.txt.erb +11 -0
- data/lib/phusion_passenger/templates/nginx/possible_solutions_for_download_and_extraction_problems.txt.erb +20 -0
- data/lib/phusion_passenger/templates/nginx/query_download_and_install.txt.erb +21 -0
- data/lib/phusion_passenger/templates/nginx/run_installer_as_root.txt.erb +8 -0
- data/lib/phusion_passenger/templates/nginx/welcome.txt.erb +15 -0
- data/lib/phusion_passenger/utils.rb +20 -15
- data/lib/phusion_passenger/wsgi/application_spawner.rb +18 -11
- data/lib/phusion_passenger/wsgi/request_handler.py +23 -0
- data/misc/copy_boost_headers.rb +23 -0
- data/misc/find_owner_pipe_leaks.rb +18 -11
- data/misc/rake/cplusplus.rb +18 -11
- data/misc/rake/extensions.rb +21 -14
- data/misc/render_error_pages.rb +18 -11
- data/test/ApplicationPoolServerTest.cpp +1 -3
- data/test/ApplicationPoolServer_ApplicationPoolTest.cpp +1 -1
- data/test/CxxTestMain.cpp +19 -3
- data/test/HttpStatusExtractorTest.cpp +181 -0
- data/test/ScgiRequestParserTest.cpp +337 -0
- data/test/StaticStringTest.cpp +51 -0
- data/test/UtilsTest.cpp +32 -0
- data/test/config.yml.example +5 -0
- data/test/{integration_tests.rb → integration_tests/apache2_tests.rb} +7 -299
- data/test/integration_tests/hello_world_rack_spec.rb +36 -0
- data/test/integration_tests/hello_world_wsgi_spec.rb +41 -0
- data/test/integration_tests/mycook_spec.rb +192 -0
- data/test/integration_tests/nginx_tests.rb +98 -0
- data/test/ruby/rack/application_spawner_spec.rb +40 -0
- data/test/stub/nginx/koi-utf +109 -0
- data/test/stub/nginx/koi-win +103 -0
- data/test/stub/nginx/mime.types +70 -0
- data/test/stub/nginx/nginx.conf.erb +57 -0
- data/test/stub/nginx/win-utf +126 -0
- data/test/stub/rails_apps/mycook/app/controllers/uploads_controller.rb +4 -0
- data/test/stub/rails_apps/mycook/config/routes.rb +1 -1
- data/test/stub/wsgi/passenger_wsgi.pyc +0 -0
- data/test/support/Support.h +40 -0
- data/test/support/nginx_controller.rb +98 -0
- data/test/support/test_helper.rb +79 -0
- metadata +1091 -1028
- data/benchmark/DummyRequestHandler.cpp +0 -101
- data/ext/apache2/Logging.cpp +0 -60
- data/ext/apache2/SystemTime.cpp +0 -28
@@ -1,21 +1,26 @@
|
|
1
1
|
/*
|
2
2
|
* Phusion Passenger - http://www.modrails.com/
|
3
|
-
* Copyright (
|
3
|
+
* Copyright (c) 2008, 2009 Phusion
|
4
4
|
*
|
5
|
-
* Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
|
5
|
+
* "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
6
6
|
*
|
7
|
-
*
|
8
|
-
*
|
9
|
-
* the
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
12
|
+
* furnished to do so, subject to the following conditions:
|
10
13
|
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
* GNU General Public License for more details.
|
14
|
+
* The above copyright notice and this permission notice shall be included in
|
15
|
+
* all copies or substantial portions of the Software.
|
15
16
|
*
|
16
|
-
*
|
17
|
-
*
|
18
|
-
*
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
* THE SOFTWARE.
|
19
24
|
*/
|
20
25
|
#ifndef _PASSENGER_APPLICATION_POOL_SERVER_H_
|
21
26
|
#define _PASSENGER_APPLICATION_POOL_SERVER_H_
|
@@ -465,7 +470,6 @@ private:
|
|
465
470
|
string m_logFile;
|
466
471
|
string m_rubyCommand;
|
467
472
|
string m_user;
|
468
|
-
string statusReportFIFO;
|
469
473
|
|
470
474
|
/**
|
471
475
|
* The PID of the ApplicationPool server process. If no server process
|
@@ -502,11 +506,6 @@ private:
|
|
502
506
|
bool done = false;
|
503
507
|
|
504
508
|
syscalls::close(serverSocket);
|
505
|
-
if (!statusReportFIFO.empty()) {
|
506
|
-
do {
|
507
|
-
ret = unlink(statusReportFIFO.c_str());
|
508
|
-
} while (ret == -1 && errno == EINTR);
|
509
|
-
}
|
510
509
|
|
511
510
|
P_TRACE(2, "Waiting for existing ApplicationPoolServerExecutable (PID " <<
|
512
511
|
serverPid << ") to exit...");
|
@@ -519,7 +518,7 @@ private:
|
|
519
518
|
* signal. This must be the same as the oxt/system_calls.hpp interruption
|
520
519
|
* signal.
|
521
520
|
*/
|
522
|
-
syscalls::kill(serverPid,
|
521
|
+
syscalls::kill(serverPid, oxt::INTERRUPTION_SIGNAL);
|
523
522
|
|
524
523
|
ret = syscalls::waitpid(serverPid, &status, WNOHANG);
|
525
524
|
done = ret > 0 || ret == -1;
|
@@ -572,8 +571,6 @@ private:
|
|
572
571
|
throw SystemException("Cannot create a Unix socket pair", errno);
|
573
572
|
}
|
574
573
|
|
575
|
-
createStatusReportFIFO();
|
576
|
-
|
577
574
|
pid = syscalls::fork();
|
578
575
|
if (pid == 0) { // Child process.
|
579
576
|
dup2(STDERR_FILENO, STDOUT_FILENO); // Redirect stdout to the same channel as stderr.
|
@@ -597,7 +594,6 @@ private:
|
|
597
594
|
m_logFile.c_str(),
|
598
595
|
m_rubyCommand.c_str(),
|
599
596
|
m_user.c_str(),
|
600
|
-
statusReportFIFO.c_str(),
|
601
597
|
(char *) 0);
|
602
598
|
int e = errno;
|
603
599
|
fprintf(stderr, "*** Passenger ERROR (%s:%d):\n"
|
@@ -622,56 +618,6 @@ private:
|
|
622
618
|
serverPid = pid;
|
623
619
|
}
|
624
620
|
}
|
625
|
-
|
626
|
-
void createStatusReportFIFO() {
|
627
|
-
TRACE_POINT();
|
628
|
-
char filename[PATH_MAX];
|
629
|
-
int ret;
|
630
|
-
mode_t permissions = S_IRUSR | S_IWUSR;
|
631
|
-
|
632
|
-
createPassengerTempDir(getSystemTempDir(), m_user.empty(),
|
633
|
-
"nobody", geteuid(), getegid());
|
634
|
-
|
635
|
-
snprintf(filename, sizeof(filename), "%s/info/status.fifo",
|
636
|
-
getPassengerTempDir().c_str());
|
637
|
-
filename[PATH_MAX - 1] = '\0';
|
638
|
-
do {
|
639
|
-
ret = mkfifo(filename, permissions);
|
640
|
-
} while (ret == -1 && errno == EINTR);
|
641
|
-
if (ret == -1 && errno != EEXIST) {
|
642
|
-
int e = errno;
|
643
|
-
P_WARN("*** WARNING: Could not create FIFO '" << filename <<
|
644
|
-
"': " << strerror(e) << " (" << e << ")" << endl <<
|
645
|
-
"Disabling Passenger ApplicationPool status reporting.");
|
646
|
-
statusReportFIFO = "";
|
647
|
-
} else {
|
648
|
-
statusReportFIFO = filename;
|
649
|
-
|
650
|
-
// It seems that the permissions passed to mkfifo()
|
651
|
-
// aren't respected, so here we chmod the file.
|
652
|
-
do {
|
653
|
-
ret = chmod(filename, permissions);
|
654
|
-
} while (ret == -1 && errno == EINTR);
|
655
|
-
|
656
|
-
// Set the FIFO's owner according to whether we're running as root
|
657
|
-
// and whether user switching is enabled.
|
658
|
-
if (geteuid() == 0 && !m_user.empty()) {
|
659
|
-
uid_t uid;
|
660
|
-
gid_t gid;
|
661
|
-
|
662
|
-
determineLowestUserAndGroup(m_user, uid, gid);
|
663
|
-
do {
|
664
|
-
ret = chown(filename, uid, gid);
|
665
|
-
} while (ret == -1 && errno == EINTR);
|
666
|
-
if (errno == -1) {
|
667
|
-
int e = errno;
|
668
|
-
P_WARN("*** WARNING: Unable to set the FIFO file '" <<
|
669
|
-
filename << "' its owner and group to that of user " <<
|
670
|
-
m_user << ": " << strerror(e) << " (" << e << ")");
|
671
|
-
}
|
672
|
-
}
|
673
|
-
}
|
674
|
-
}
|
675
621
|
|
676
622
|
public:
|
677
623
|
/**
|
@@ -1,21 +1,26 @@
|
|
1
1
|
/*
|
2
2
|
* Phusion Passenger - http://www.modrails.com/
|
3
|
-
* Copyright (
|
3
|
+
* Copyright (c) 2008, 2009 Phusion
|
4
4
|
*
|
5
|
-
* Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
|
5
|
+
* "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
6
6
|
*
|
7
|
-
*
|
8
|
-
*
|
9
|
-
* the
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
12
|
+
* furnished to do so, subject to the following conditions:
|
10
13
|
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
* GNU General Public License for more details.
|
14
|
+
* The above copyright notice and this permission notice shall be included in
|
15
|
+
* all copies or substantial portions of the Software.
|
15
16
|
*
|
16
|
-
*
|
17
|
-
*
|
18
|
-
*
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
* THE SOFTWARE.
|
19
24
|
*/
|
20
25
|
#ifndef _PASSENGER_APPLICATION_POOL_SERVER_EXECUTABLE_H_
|
21
26
|
#define _PASSENGER_APPLICATION_POOL_SERVER_EXECUTABLE_H_
|
@@ -56,6 +61,7 @@
|
|
56
61
|
|
57
62
|
#include "MessageChannel.h"
|
58
63
|
#include "StandardApplicationPool.h"
|
64
|
+
#include "ApplicationPoolStatusReporter.h"
|
59
65
|
#include "Application.h"
|
60
66
|
#include "Logging.h"
|
61
67
|
#include "Exceptions.h"
|
@@ -91,72 +97,11 @@ private:
|
|
91
97
|
friend class Client;
|
92
98
|
|
93
99
|
int serverSocket;
|
94
|
-
|
100
|
+
StandardApplicationPoolPtr pool;
|
95
101
|
set<ClientPtr> clients;
|
96
102
|
boost::mutex lock;
|
97
|
-
string statusReportFIFO;
|
98
|
-
shared_ptr<oxt::thread> statusReportThread;
|
99
103
|
string user;
|
100
|
-
|
101
|
-
void statusReportThreadMain() {
|
102
|
-
TRACE_POINT();
|
103
|
-
try {
|
104
|
-
while (!this_thread::interruption_requested()) {
|
105
|
-
struct stat buf;
|
106
|
-
int ret;
|
107
|
-
|
108
|
-
UPDATE_TRACE_POINT();
|
109
|
-
do {
|
110
|
-
ret = stat(statusReportFIFO.c_str(), &buf);
|
111
|
-
} while (ret == -1 && errno == EINTR);
|
112
|
-
if (ret == -1 || !S_ISFIFO(buf.st_mode)) {
|
113
|
-
// Something bad happened with the status report
|
114
|
-
// FIFO, so we bail out.
|
115
|
-
break;
|
116
|
-
}
|
117
|
-
|
118
|
-
UPDATE_TRACE_POINT();
|
119
|
-
FILE *f = syscalls::fopen(statusReportFIFO.c_str(), "w");
|
120
|
-
if (f == NULL) {
|
121
|
-
int e = errno;
|
122
|
-
P_ERROR("Cannot open status report FIFO " <<
|
123
|
-
statusReportFIFO << ": " <<
|
124
|
-
strerror(e) << " (" << e << ")");
|
125
|
-
break;
|
126
|
-
}
|
127
|
-
|
128
|
-
UPDATE_TRACE_POINT();
|
129
|
-
MessageChannel channel(fileno(f));
|
130
|
-
string report;
|
131
|
-
report.append("----------- Backtraces -----------\n");
|
132
|
-
report.append(oxt::thread::all_backtraces());
|
133
|
-
report.append("\n\n");
|
134
|
-
report.append(pool.toString());
|
135
|
-
|
136
|
-
UPDATE_TRACE_POINT();
|
137
|
-
try {
|
138
|
-
channel.writeScalar(report);
|
139
|
-
channel.writeScalar(pool.toXml());
|
140
|
-
} catch (...) {
|
141
|
-
// Ignore write errors.
|
142
|
-
}
|
143
|
-
syscalls::fclose(f);
|
144
|
-
}
|
145
|
-
} catch (const boost::thread_interrupted &) {
|
146
|
-
P_TRACE(2, "Status report thread interrupted.");
|
147
|
-
}
|
148
|
-
}
|
149
|
-
|
150
|
-
void deleteStatusReportFIFO() {
|
151
|
-
TRACE_POINT();
|
152
|
-
if (!statusReportFIFO.empty()) {
|
153
|
-
int ret;
|
154
|
-
do {
|
155
|
-
ret = unlink(statusReportFIFO.c_str());
|
156
|
-
} while (ret == -1 && errno == EINTR);
|
157
|
-
}
|
158
|
-
}
|
159
|
-
|
104
|
+
|
160
105
|
/**
|
161
106
|
* Lowers this process's privilege to that of <em>username</em>,
|
162
107
|
* and sets stricter permissions for the Phusion Passenger temp
|
@@ -254,7 +199,6 @@ private:
|
|
254
199
|
sigaction(SIGSEGV, &action, NULL);
|
255
200
|
sigaction(SIGALRM, &action, NULL);
|
256
201
|
sigaction(SIGUSR1, &action, NULL);
|
257
|
-
sigaction(SIGUSR2, &action, NULL);
|
258
202
|
}
|
259
203
|
}
|
260
204
|
|
@@ -264,13 +208,12 @@ public:
|
|
264
208
|
const string &spawnServerCommand,
|
265
209
|
const string &logFile,
|
266
210
|
const string &rubyCommand,
|
267
|
-
const string &user
|
268
|
-
|
269
|
-
|
270
|
-
|
211
|
+
const string &user)
|
212
|
+
{
|
213
|
+
pool = ptr(new StandardApplicationPool(spawnServerCommand,
|
214
|
+
logFile, rubyCommand, user));
|
271
215
|
Passenger::setLogLevel(logLevel);
|
272
216
|
this->serverSocket = serverSocket;
|
273
|
-
this->statusReportFIFO = statusReportFIFO;
|
274
217
|
this->user = user;
|
275
218
|
|
276
219
|
P_TRACE(2, "ApplicationPoolServerExecutable initialized (PID " << getpid() << ")");
|
@@ -285,11 +228,6 @@ public:
|
|
285
228
|
|
286
229
|
syscalls::close(serverSocket);
|
287
230
|
|
288
|
-
if (statusReportThread != NULL) {
|
289
|
-
UPDATE_TRACE_POINT();
|
290
|
-
statusReportThread->interrupt_and_join();
|
291
|
-
}
|
292
|
-
|
293
231
|
// Wait for all clients to disconnect.
|
294
232
|
UPDATE_TRACE_POINT();
|
295
233
|
set<ClientPtr> clientsCopy;
|
@@ -304,7 +242,6 @@ public:
|
|
304
242
|
clients.clear();
|
305
243
|
}
|
306
244
|
clientsCopy.clear();
|
307
|
-
deleteStatusReportFIFO();
|
308
245
|
|
309
246
|
P_TRACE(2, "Server shutdown complete.");
|
310
247
|
}
|
@@ -355,7 +292,7 @@ private:
|
|
355
292
|
|
356
293
|
try {
|
357
294
|
PoolOptions options(args, 1);
|
358
|
-
session = server.pool
|
295
|
+
session = server.pool->get(options);
|
359
296
|
sessions[lastSessionID] = session;
|
360
297
|
lastSessionID++;
|
361
298
|
} catch (const SpawnException &e) {
|
@@ -410,37 +347,37 @@ private:
|
|
410
347
|
|
411
348
|
void processClear(const vector<string> &args) {
|
412
349
|
TRACE_POINT();
|
413
|
-
server.pool
|
350
|
+
server.pool->clear();
|
414
351
|
}
|
415
352
|
|
416
353
|
void processSetMaxIdleTime(const vector<string> &args) {
|
417
354
|
TRACE_POINT();
|
418
|
-
server.pool
|
355
|
+
server.pool->setMaxIdleTime(atoi(args[1]));
|
419
356
|
}
|
420
357
|
|
421
358
|
void processSetMax(const vector<string> &args) {
|
422
359
|
TRACE_POINT();
|
423
|
-
server.pool
|
360
|
+
server.pool->setMax(atoi(args[1]));
|
424
361
|
}
|
425
362
|
|
426
363
|
void processGetActive(const vector<string> &args) {
|
427
364
|
TRACE_POINT();
|
428
|
-
channel.write(toString(server.pool
|
365
|
+
channel.write(toString(server.pool->getActive()).c_str(), NULL);
|
429
366
|
}
|
430
367
|
|
431
368
|
void processGetCount(const vector<string> &args) {
|
432
369
|
TRACE_POINT();
|
433
|
-
channel.write(toString(server.pool
|
370
|
+
channel.write(toString(server.pool->getCount()).c_str(), NULL);
|
434
371
|
}
|
435
372
|
|
436
373
|
void processSetMaxPerApp(unsigned int maxPerApp) {
|
437
374
|
TRACE_POINT();
|
438
|
-
server.pool
|
375
|
+
server.pool->setMaxPerApp(maxPerApp);
|
439
376
|
}
|
440
377
|
|
441
378
|
void processGetSpawnServerPid(const vector<string> &args) {
|
442
379
|
TRACE_POINT();
|
443
|
-
channel.write(toString(server.pool
|
380
|
+
channel.write(toString(server.pool->getSpawnServerPid()).c_str(), NULL);
|
444
381
|
}
|
445
382
|
|
446
383
|
void processUnknownMessage(const vector<string> &args) {
|
@@ -584,15 +521,19 @@ Server::start() {
|
|
584
521
|
setup_syscall_interruption_support();
|
585
522
|
|
586
523
|
try {
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
524
|
+
uid_t fifoUid;
|
525
|
+
gid_t fifoGid;
|
526
|
+
|
527
|
+
// Set the FIFO's owner according to whether we're running as root
|
528
|
+
// and whether user switching is enabled.
|
529
|
+
if (geteuid() == 0 && !user.empty()) {
|
530
|
+
determineLowestUserAndGroup(user, fifoUid, fifoGid);
|
531
|
+
} else {
|
532
|
+
fifoUid = (uid_t) -1;
|
533
|
+
fifoGid = (gid_t) -1;
|
595
534
|
}
|
535
|
+
ApplicationPoolStatusReporter reporter(pool, user.empty(),
|
536
|
+
S_IRUSR | S_IWUSR, fifoUid, fifoGid);
|
596
537
|
|
597
538
|
if (!user.empty()) {
|
598
539
|
lowerPrivilege(user);
|
@@ -654,7 +595,7 @@ main(int argc, char *argv[]) {
|
|
654
595
|
try {
|
655
596
|
exeFile = argv[0];
|
656
597
|
Server server(SERVER_SOCKET_FD, atoi(argv[1]),
|
657
|
-
argv[2], argv[3], argv[4], argv[5]
|
598
|
+
argv[2], argv[3], argv[4], argv[5]);
|
658
599
|
return server.start();
|
659
600
|
} catch (const tracable_exception &e) {
|
660
601
|
P_ERROR("*** Fatal error: " << e.what() << "\n" << e.backtrace());
|
@@ -0,0 +1,212 @@
|
|
1
|
+
/*
|
2
|
+
* Phusion Passenger - http://www.modrails.com/
|
3
|
+
* Copyright (c) 2008, 2009 Phusion
|
4
|
+
*
|
5
|
+
* "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
6
|
+
*
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
12
|
+
* furnished to do so, subject to the following conditions:
|
13
|
+
*
|
14
|
+
* The above copyright notice and this permission notice shall be included in
|
15
|
+
* all copies or substantial portions of the Software.
|
16
|
+
*
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
* THE SOFTWARE.
|
24
|
+
*/
|
25
|
+
#ifndef _PASSENGER_APPLICATION_POOL_STATUS_REPORTER_H_
|
26
|
+
#define _PASSENGER_APPLICATION_POOL_STATUS_REPORTER_H_
|
27
|
+
|
28
|
+
#include <boost/bind.hpp>
|
29
|
+
#include <boost/thread.hpp>
|
30
|
+
#include <oxt/thread.hpp>
|
31
|
+
#include <oxt/backtrace.hpp>
|
32
|
+
#include <oxt/system_calls.hpp>
|
33
|
+
|
34
|
+
#include <string>
|
35
|
+
#include <sys/types.h>
|
36
|
+
#include <sys/stat.h>
|
37
|
+
#include <cstdio>
|
38
|
+
#include <unistd.h>
|
39
|
+
#include <errno.h>
|
40
|
+
|
41
|
+
#include "StandardApplicationPool.h"
|
42
|
+
#include "MessageChannel.h"
|
43
|
+
#include "Logging.h"
|
44
|
+
#include "Utils.h"
|
45
|
+
|
46
|
+
namespace Passenger {
|
47
|
+
|
48
|
+
using namespace boost;
|
49
|
+
using namespace oxt;
|
50
|
+
using namespace std;
|
51
|
+
|
52
|
+
/**
|
53
|
+
* An ApplicationPoolStatusReporter allows commandline admin tools to inspect
|
54
|
+
* the status of a StandardApplicationPool. It does so by creating a FIFO
|
55
|
+
* in the Passenger temp folder.
|
56
|
+
*
|
57
|
+
* An ApplicationPoolStatusReporter creates a background thread, which
|
58
|
+
* continuously sends new information through the FIFO. This thread will
|
59
|
+
* be automatically cleaned up upon destroying the ApplicationPoolStatusReporter
|
60
|
+
* object.
|
61
|
+
*/
|
62
|
+
class ApplicationPoolStatusReporter {
|
63
|
+
private:
|
64
|
+
/** The application pool to monitor. */
|
65
|
+
StandardApplicationPoolPtr pool;
|
66
|
+
|
67
|
+
/** The FIFO's filename. */
|
68
|
+
char filename[PATH_MAX];
|
69
|
+
|
70
|
+
/** The background thread. */
|
71
|
+
oxt::thread *thr;
|
72
|
+
|
73
|
+
void threadMain() {
|
74
|
+
TRACE_POINT();
|
75
|
+
try {
|
76
|
+
while (!this_thread::interruption_requested()) {
|
77
|
+
struct stat buf;
|
78
|
+
int ret;
|
79
|
+
|
80
|
+
UPDATE_TRACE_POINT();
|
81
|
+
do {
|
82
|
+
ret = stat(filename, &buf);
|
83
|
+
} while (ret == -1 && errno == EINTR);
|
84
|
+
if (ret == -1 || !S_ISFIFO(buf.st_mode)) {
|
85
|
+
// Something bad happened with the status
|
86
|
+
// report FIFO, so we bail out.
|
87
|
+
break;
|
88
|
+
}
|
89
|
+
|
90
|
+
UPDATE_TRACE_POINT();
|
91
|
+
FILE *f = syscalls::fopen(filename, "w");
|
92
|
+
if (f == NULL) {
|
93
|
+
int e = errno;
|
94
|
+
P_ERROR("Cannot open status report FIFO " <<
|
95
|
+
filename << ": " <<
|
96
|
+
strerror(e) << " (" << e << ")");
|
97
|
+
break;
|
98
|
+
}
|
99
|
+
|
100
|
+
UPDATE_TRACE_POINT();
|
101
|
+
MessageChannel channel(fileno(f));
|
102
|
+
string report;
|
103
|
+
report.append("----------- Backtraces -----------\n");
|
104
|
+
report.append(oxt::thread::all_backtraces());
|
105
|
+
report.append("\n\n");
|
106
|
+
report.append(pool->toString());
|
107
|
+
|
108
|
+
UPDATE_TRACE_POINT();
|
109
|
+
try {
|
110
|
+
channel.writeScalar(report);
|
111
|
+
channel.writeScalar(pool->toXml());
|
112
|
+
} catch (...) {
|
113
|
+
// Ignore write errors.
|
114
|
+
}
|
115
|
+
syscalls::fclose(f);
|
116
|
+
}
|
117
|
+
} catch (const boost::thread_interrupted &) {
|
118
|
+
P_TRACE(2, "Status report thread interrupted.");
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
public:
|
123
|
+
/**
|
124
|
+
* Creates a new ApplicationPoolStatusReporter.
|
125
|
+
*
|
126
|
+
* @param pool The application pool to monitor.
|
127
|
+
* @param userSwitching Whether user switching is enabled. This is used
|
128
|
+
* for determining the optimal permissions for the
|
129
|
+
* FIFO file and the temp directory that might get
|
130
|
+
* created.
|
131
|
+
* @param permissions The permissions with which the FIFO should
|
132
|
+
* be created.
|
133
|
+
* @param uid The UID of the user who should own the FIFO file, or
|
134
|
+
* -1 if the current user should be set as owner.
|
135
|
+
* @param gid The GID of the user who should own the FIFO file, or
|
136
|
+
* -1 if the current group should be set as group.
|
137
|
+
* @throws SystemException An error occurred while creating the FIFO.
|
138
|
+
* @throws boost::thread_resource_error Something went wrong during
|
139
|
+
* creation of the thread.
|
140
|
+
*/
|
141
|
+
ApplicationPoolStatusReporter(StandardApplicationPoolPtr &pool,
|
142
|
+
bool userSwitching,
|
143
|
+
mode_t permissions = S_IRUSR | S_IWUSR,
|
144
|
+
uid_t uid = -1, gid_t gid = -1) {
|
145
|
+
int ret;
|
146
|
+
|
147
|
+
this->pool = pool;
|
148
|
+
|
149
|
+
createPassengerTempDir(getSystemTempDir(), userSwitching,
|
150
|
+
"nobody", geteuid(), getegid());
|
151
|
+
|
152
|
+
snprintf(filename, sizeof(filename) - 1, "%s/info/status.fifo",
|
153
|
+
getPassengerTempDir().c_str());
|
154
|
+
filename[PATH_MAX - 1] = '\0';
|
155
|
+
|
156
|
+
do {
|
157
|
+
ret = mkfifo(filename, permissions);
|
158
|
+
} while (ret == -1 && errno == EINTR);
|
159
|
+
if (ret == -1 && errno != EEXIST) {
|
160
|
+
int e = errno;
|
161
|
+
string message("Cannot create FIFO '");
|
162
|
+
message.append(filename);
|
163
|
+
message.append("'");
|
164
|
+
throw SystemException(message, e);
|
165
|
+
}
|
166
|
+
|
167
|
+
// It seems that the permissions passed to mkfifo()
|
168
|
+
// aren't respected, so here we chmod the file.
|
169
|
+
do {
|
170
|
+
ret = chmod(filename, permissions);
|
171
|
+
} while (ret == -1 && errno == EINTR);
|
172
|
+
|
173
|
+
if (uid != (uid_t) -1 && gid != (gid_t) -1) {
|
174
|
+
do {
|
175
|
+
ret = chown(filename, uid, gid);
|
176
|
+
} while (ret == -1 && errno == EINTR);
|
177
|
+
if (errno == -1) {
|
178
|
+
int e = errno;
|
179
|
+
char message[1024];
|
180
|
+
|
181
|
+
snprintf(message, sizeof(message) - 1,
|
182
|
+
"Cannot set the FIFO file '%s' its owner to %lld and group to %lld",
|
183
|
+
filename, (long long) uid, (long long) gid);
|
184
|
+
message[sizeof(message) - 1] = '\0';
|
185
|
+
throw SystemException(message, e);
|
186
|
+
}
|
187
|
+
}
|
188
|
+
|
189
|
+
thr = new oxt::thread(
|
190
|
+
bind(&ApplicationPoolStatusReporter::threadMain, this),
|
191
|
+
"Status report thread",
|
192
|
+
1024 * 128
|
193
|
+
);
|
194
|
+
}
|
195
|
+
|
196
|
+
~ApplicationPoolStatusReporter() {
|
197
|
+
this_thread::disable_syscall_interruption dsi;
|
198
|
+
this_thread::disable_interruption di;
|
199
|
+
|
200
|
+
thr->interrupt_and_join();
|
201
|
+
delete thr;
|
202
|
+
|
203
|
+
int ret;
|
204
|
+
do {
|
205
|
+
ret = unlink(filename);
|
206
|
+
} while (ret == -1 && errno == EINTR);
|
207
|
+
}
|
208
|
+
};
|
209
|
+
|
210
|
+
} // namespace Passenger
|
211
|
+
|
212
|
+
#endif /* _PASSENGER_APPLICATION_POOL_STATUS_REPORTER_H_ */
|