passenger 5.2.3 → 5.3.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.
- checksums.yaml +4 -4
- data/CHANGELOG +13 -0
- data/CONTRIBUTORS +5 -1
- data/build/agent.rb +22 -2
- data/build/cxx_tests.rb +41 -5
- data/build/misc.rb +4 -1
- data/build/support/cxx_dependency_map.rb +1746 -908
- data/build/support/vendor/cxx_hinted_parser/CxxHintedParser.sublime-project +8 -0
- data/build/support/vendor/cxx_hinted_parser/Gemfile +5 -0
- data/build/support/vendor/cxx_hinted_parser/Gemfile.lock +30 -0
- data/{src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core → build/support/vendor/cxx_hinted_parser}/LICENSE.md +1 -1
- data/build/support/vendor/cxx_hinted_parser/README.md +95 -0
- data/build/support/vendor/cxx_hinted_parser/Rakefile +4 -0
- data/{src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/initialize.rb → build/support/vendor/cxx_hinted_parser/lib/cxx_hinted_parser.rb} +2 -9
- data/build/support/vendor/cxx_hinted_parser/lib/cxx_hinted_parser/parser.rb +239 -0
- data/dev/ci/README.md +15 -2
- data/dev/ci/lib/set-container-envvars.sh +6 -0
- data/dev/ci/lib/setup-container.sh +4 -1
- data/dev/ci/scripts/debug-console-wrapper.sh +3 -1
- data/dev/ci/setup-host +5 -0
- data/dev/ci/tests/binaries/Jenkinsfile +105 -0
- data/dev/ci/tests/binaries/build-linux +38 -0
- data/dev/ci/tests/binaries/build-macos +40 -0
- data/dev/ci/tests/binaries/prepare-macos +38 -0
- data/dev/ci/tests/binaries/test-linux +45 -0
- data/dev/ci/tests/binaries/test-macos +38 -0
- data/dev/ci/tests/debian/Jenkinsfile +2 -2
- data/dev/ci/tests/rpm/Jenkinsfile +1 -1
- data/dev/configkit-schemas/index.json +3 -24
- data/dev/vagrant/nginx_rakefile +0 -1
- data/package.json +15 -5
- data/resources/templates/error_renderer/.editorconfig +19 -0
- data/resources/templates/error_renderer/with_details/README.md +9 -0
- data/resources/templates/error_renderer/with_details/dist/bundle.js +33 -0
- data/resources/templates/error_renderer/with_details/dist/styles.css +17 -0
- data/resources/templates/error_renderer/with_details/src/DetailsView.jsx +52 -0
- data/resources/templates/error_renderer/with_details/src/GetHelpView.jsx +61 -0
- data/resources/templates/error_renderer/with_details/src/JourneyView.css +50 -0
- data/resources/templates/error_renderer/with_details/src/JourneyView.jsx +621 -0
- data/resources/templates/error_renderer/with_details/src/PageMain.css +114 -0
- data/resources/templates/error_renderer/with_details/src/PageMain.jsx +136 -0
- data/resources/templates/error_renderer/with_details/src/ProblemDescriptionView.jsx +14 -0
- data/resources/templates/error_renderer/with_details/src/ProcessDetailsView.jsx +56 -0
- data/resources/templates/error_renderer/with_details/src/SolutionDescriptionView.css +5 -0
- data/resources/templates/error_renderer/with_details/src/SolutionDescriptionView.jsx +15 -0
- data/resources/templates/error_renderer/with_details/src/SummaryView.jsx +35 -0
- data/resources/templates/error_renderer/with_details/src/SystemComponentView.css +34 -0
- data/resources/templates/error_renderer/with_details/src/SystemComponentView.jsx +168 -0
- data/resources/templates/error_renderer/with_details/src/SystemComponentsView.css +13 -0
- data/resources/templates/error_renderer/with_details/src/SystemComponentsView.jsx +116 -0
- data/resources/templates/error_renderer/with_details/src/Tab.jsx +12 -0
- data/resources/templates/error_renderer/with_details/src/Tabs.jsx +104 -0
- data/resources/templates/error_renderer/with_details/src/bootstrap/bootstrap.css +3446 -0
- data/resources/templates/error_renderer/with_details/src/bootstrap/bootstrap.js +293 -0
- data/resources/templates/error_renderer/with_details/src/bootstrap/config.json +401 -0
- data/resources/templates/error_renderer/with_details/src/index.html.template +22 -0
- data/resources/templates/error_renderer/with_details/src/index.jsx +23 -0
- data/resources/templates/error_renderer/with_details/webpack.config.js +47 -0
- data/resources/templates/error_renderer/without_details/dist/bundle.js +1 -0
- data/resources/templates/error_renderer/without_details/dist/styles.css +1 -0
- data/resources/templates/{undisclosed_error.html.template → error_renderer/without_details/src/index.html.template} +7 -11
- data/resources/templates/error_renderer/without_details/src/index.js +1 -0
- data/resources/templates/{error_layout.css → error_renderer/without_details/src/main.css} +5 -2
- data/resources/templates/error_renderer/without_details/webpack.config.js +42 -0
- data/src/agent/AgentMain.cpp +3 -3
- data/src/agent/Core/ApplicationPool/BasicProcessInfo.h +13 -0
- data/src/agent/Core/ApplicationPool/Common.h +3 -4
- data/src/agent/Core/ApplicationPool/Context.h +27 -17
- data/src/agent/Core/ApplicationPool/Group.h +3 -1
- data/src/agent/Core/ApplicationPool/Group/InitializationAndShutdown.cpp +2 -12
- data/src/agent/Core/ApplicationPool/Group/InternalUtils.cpp +55 -10
- data/src/agent/Core/ApplicationPool/Group/LifetimeAndBasics.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/OutOfBandWork.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/SpawningAndRestarting.cpp +13 -6
- data/src/agent/Core/ApplicationPool/Implementation.cpp +16 -100
- data/src/agent/Core/ApplicationPool/Options.h +8 -65
- data/src/agent/Core/ApplicationPool/Pool.h +4 -21
- data/src/agent/Core/ApplicationPool/Pool/AnalyticsCollection.cpp +1 -60
- data/src/agent/Core/ApplicationPool/Pool/GeneralUtils.cpp +10 -13
- data/src/agent/Core/ApplicationPool/Pool/InitializationAndShutdown.cpp +3 -8
- data/src/agent/Core/ApplicationPool/Pool/Miscellaneous.cpp +2 -34
- data/src/agent/Core/ApplicationPool/Pool/StateInspection.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Process.cpp +17 -12
- data/src/agent/Core/ApplicationPool/Process.h +146 -93
- data/src/agent/Core/ApplicationPool/Session.h +2 -2
- data/src/agent/Core/ApplicationPool/Socket.h +28 -27
- data/src/agent/Core/Config.h +1 -3
- data/src/agent/Core/ConfigChange.cpp +2 -4
- data/src/agent/Core/Controller.h +2 -8
- data/src/agent/Core/Controller/BufferBody.cpp +0 -2
- data/src/agent/Core/Controller/CheckoutSession.cpp +12 -24
- data/src/agent/Core/Controller/Config.h +1 -9
- data/src/agent/Core/Controller/ForwardResponse.cpp +0 -34
- data/src/agent/Core/Controller/Hooks.cpp +0 -7
- data/src/agent/Core/Controller/InitRequest.cpp +0 -43
- data/src/agent/Core/Controller/InitializationAndShutdown.cpp +0 -4
- data/src/agent/Core/Controller/Request.h +1 -35
- data/src/agent/Core/Controller/SendRequest.cpp +0 -32
- data/src/agent/Core/CoreMain.cpp +19 -32
- data/src/agent/Core/SpawningKit/Config.h +329 -55
- data/src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h +369 -0
- data/src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h.cxxcodebuilder +307 -0
- data/src/agent/Core/SpawningKit/Context.h +211 -0
- data/src/agent/Core/SpawningKit/DirectSpawner.h +112 -122
- data/src/agent/Core/SpawningKit/DummySpawner.h +59 -20
- data/src/agent/Core/SpawningKit/ErrorRenderer.h +117 -0
- data/src/agent/Core/SpawningKit/Exceptions.h +1157 -0
- data/src/agent/Core/SpawningKit/Factory.h +24 -17
- data/src/agent/Core/SpawningKit/{BackgroundIOCapturer.h → Handshake/BackgroundIOCapturer.h} +48 -18
- data/src/agent/Core/SpawningKit/Handshake/Perform.h +1650 -0
- data/src/agent/Core/SpawningKit/Handshake/Prepare.h +582 -0
- data/src/agent/Core/SpawningKit/Handshake/Session.h +91 -0
- data/src/agent/Core/SpawningKit/Handshake/WorkDir.h +100 -0
- data/src/agent/Core/SpawningKit/Journey.h +561 -0
- data/src/agent/Core/SpawningKit/PipeWatcher.h +41 -18
- data/src/agent/Core/SpawningKit/README.md +534 -0
- data/src/agent/Core/SpawningKit/Result.h +182 -7
- data/src/agent/Core/SpawningKit/Result/AutoGeneratedCode.h +69 -0
- data/src/agent/Core/SpawningKit/Result/AutoGeneratedCode.h.cxxcodebuilder +110 -0
- data/src/agent/Core/SpawningKit/SmartSpawner.h +1027 -562
- data/src/agent/Core/SpawningKit/Spawner.h +70 -1134
- data/src/agent/Core/SpawningKit/UserSwitchingRules.h +3 -33
- data/src/agent/README.md +2 -3
- data/src/agent/Shared/ApiServerUtils.h +2 -3
- data/src/agent/SpawnEnvSetupper/SpawnEnvSetupperMain.cpp +932 -0
- data/src/agent/Watchdog/Config.h +1 -3
- data/src/agent/Watchdog/WatchdogMain.cpp +2 -1
- data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp +5 -0
- data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp +5 -0
- data/src/apache2_module/ConfigGeneral/ManifestGeneration.h +22 -13
- data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp +5 -0
- data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp +3 -0
- data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp +13 -0
- data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp +7 -0
- data/src/apache2_module/DirConfig/AutoGeneratedStruct.h +13 -0
- data/src/cxx_supportlib/Constants.h +3 -1
- data/src/cxx_supportlib/Exceptions.h +0 -121
- data/src/cxx_supportlib/LoggingKit/Implementation.cpp +7 -6
- data/src/cxx_supportlib/LoggingKit/Logging.h +3 -1
- data/src/cxx_supportlib/Utils.cpp +42 -0
- data/src/cxx_supportlib/Utils.h +7 -0
- data/src/cxx_supportlib/Utils/IOUtils.cpp +58 -0
- data/src/cxx_supportlib/Utils/IOUtils.h +13 -0
- data/src/cxx_supportlib/Utils/JsonUtils.h +130 -23
- data/src/cxx_supportlib/Utils/ScopeGuard.h +9 -4
- data/src/cxx_supportlib/Utils/StrIntUtils.cpp +7 -0
- data/src/cxx_supportlib/Utils/StrIntUtils.h +1 -0
- data/src/cxx_supportlib/Utils/SystemTime.h +1 -1
- data/src/cxx_supportlib/Utils/Timer.h +1 -1
- data/src/cxx_supportlib/WebSocketCommandReverseServer.h +6 -4
- data/src/cxx_supportlib/vendor-copy/adhoc_lve.h +1 -0
- data/src/helper-scripts/node-loader.js +54 -59
- data/src/helper-scripts/rack-loader.rb +63 -60
- data/src/helper-scripts/rack-preloader.rb +125 -72
- data/src/helper-scripts/wsgi-loader.py +100 -43
- data/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c +120 -112
- data/src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c +15 -8
- data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c +142 -142
- data/src/nginx_module/ConfigGeneral/ManifestGeneration.c +26 -15
- data/src/nginx_module/ConfigGeneral/ManifestGeneration.h +3 -0
- data/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c +76 -70
- data/src/nginx_module/LocationConfig/AutoGeneratedHeaderSerialization.c +114 -99
- data/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c +170 -156
- data/src/nginx_module/LocationConfig/AutoGeneratedMergeFunction.c +38 -35
- data/src/nginx_module/LocationConfig/AutoGeneratedStruct.h +5 -1
- data/src/ruby_supportlib/phusion_passenger.rb +5 -5
- data/src/ruby_supportlib/phusion_passenger/admin_tools/instance.rb +14 -1
- data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +8 -0
- data/src/ruby_supportlib/phusion_passenger/common_library.rb +0 -3
- data/src/ruby_supportlib/phusion_passenger/config/nginx_engine_compiler.rb +0 -1
- data/src/ruby_supportlib/phusion_passenger/constants.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb +646 -238
- data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +117 -95
- data/src/ruby_supportlib/phusion_passenger/packaging.rb +0 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/depcheck_specs/apache2.rb +5 -1
- data/src/ruby_supportlib/phusion_passenger/preloader_shared_helpers.rb +92 -69
- data/src/ruby_supportlib/phusion_passenger/public_api.rb +0 -17
- data/src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb +0 -3
- data/src/ruby_supportlib/phusion_passenger/request_handler.rb +4 -5
- data/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb +0 -22
- metadata +64 -67
- data/resources/templates/error_layout.html.template +0 -86
- data/resources/templates/general_error.html.template +0 -1
- data/resources/templates/general_error_with_html.html.template +0 -1
- data/src/agent/Core/ApplicationPool/ErrorRenderer.h +0 -131
- data/src/agent/Core/SpawningKit/Options.h +0 -41
- data/src/agent/Core/UnionStation/Connection.h +0 -173
- data/src/agent/Core/UnionStation/Context.h +0 -536
- data/src/agent/Core/UnionStation/StopwatchLog.h +0 -147
- data/src/agent/Core/UnionStation/Transaction.h +0 -249
- data/src/agent/SpawnPreparer/SpawnPreparerMain.cpp +0 -208
- data/src/cxx_supportlib/UnionStationFilterSupport.cpp +0 -67
- data/src/cxx_supportlib/UnionStationFilterSupport.h +0 -1622
- data/src/nodejs_supportlib/phusion_passenger/log_express.js +0 -106
- data/src/nodejs_supportlib/phusion_passenger/log_mongodb.js +0 -202
- data/src/nodejs_supportlib/phusion_passenger/ustreporter.js +0 -227
- data/src/nodejs_supportlib/phusion_passenger/ustrouter_connector.js +0 -448
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/CONFIG.md +0 -37
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/Gemfile +0 -17
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/Gemfile.lock +0 -59
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/README-API.md +0 -5
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/README.md +0 -117
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/Rakefile +0 -115
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core.rb +0 -423
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/api.rb +0 -238
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/connection.rb +0 -67
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/context.rb +0 -281
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/lock.rb +0 -62
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/log.rb +0 -66
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/message_channel.rb +0 -157
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter.rb +0 -150
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/basics.rb +0 -199
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/controllers.rb +0 -187
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/misc.rb +0 -303
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/view_rendering.rb +0 -91
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/simple_json.rb +0 -396
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/spec_helper.rb +0 -279
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/time_point.rb +0 -39
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/transaction.rb +0 -173
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/utils.rb +0 -177
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/version.rb +0 -32
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/version_data.rb +0 -44
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.example +0 -16
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.travis +0 -20
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.travis-with-sudo +0 -18
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/union_station_hooks_core.gemspec +0 -23
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Gemfile +0 -14
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Gemfile.lock +0 -45
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/LICENSE.md +0 -19
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/README.md +0 -104
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Rakefile +0 -160
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails.rb +0 -200
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/action_controller_extension.rb +0 -45
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/action_view_subscriber.rb +0 -55
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/active_record_subscriber.rb +0 -41
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/active_support_benchmarkable_extension.rb +0 -47
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/active_support_cache_subscriber.rb +0 -79
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/exception_logger.rb +0 -57
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/version.rb +0 -32
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/version_data.rb +0 -44
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/union_station_hooks_rails.gemspec +0 -34
@@ -0,0 +1,582 @@
|
|
1
|
+
/*
|
2
|
+
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
+
* Copyright (c) 2016-2017 Phusion Holding B.V.
|
4
|
+
*
|
5
|
+
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
6
|
+
* trademarks of Phusion Holding B.V.
|
7
|
+
*
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
* of this software and associated documentation files (the "Software"), to deal
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
13
|
+
* furnished to do so, subject to the following conditions:
|
14
|
+
*
|
15
|
+
* The above copyright notice and this permission notice shall be included in
|
16
|
+
* all copies or substantial portions of the Software.
|
17
|
+
*
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
* THE SOFTWARE.
|
25
|
+
*/
|
26
|
+
#ifndef _PASSENGER_SPAWNING_KIT_HANDSHAKE_PREPARE_H_
|
27
|
+
#define _PASSENGER_SPAWNING_KIT_HANDSHAKE_PREPARE_H_
|
28
|
+
|
29
|
+
#include <oxt/backtrace.hpp>
|
30
|
+
#include <boost/thread.hpp>
|
31
|
+
#include <boost/scoped_array.hpp>
|
32
|
+
#include <string>
|
33
|
+
#include <vector>
|
34
|
+
#include <stdexcept>
|
35
|
+
#include <algorithm>
|
36
|
+
#include <cerrno>
|
37
|
+
#include <cstddef>
|
38
|
+
#include <cassert>
|
39
|
+
|
40
|
+
#include <sys/types.h>
|
41
|
+
#include <sys/stat.h>
|
42
|
+
#include <sys/un.h>
|
43
|
+
#include <sys/socket.h>
|
44
|
+
#include <pwd.h>
|
45
|
+
#include <grp.h>
|
46
|
+
#include <unistd.h>
|
47
|
+
#include <limits.h>
|
48
|
+
|
49
|
+
#include <jsoncpp/json.h>
|
50
|
+
|
51
|
+
#include <Constants.h>
|
52
|
+
#include <LoggingKit/LoggingKit.h>
|
53
|
+
#include <StaticString.h>
|
54
|
+
#include <Exceptions.h>
|
55
|
+
#include <FileTools/FileManip.h>
|
56
|
+
#include <FileTools/PathManip.h>
|
57
|
+
#include <Utils/SystemTime.h>
|
58
|
+
#include <Utils/Timer.h>
|
59
|
+
#include <Utils/IOUtils.h>
|
60
|
+
#include <Utils/StrIntUtils.h>
|
61
|
+
#include <Core/SpawningKit/Context.h>
|
62
|
+
#include <Core/SpawningKit/Config.h>
|
63
|
+
#include <Core/SpawningKit/Journey.h>
|
64
|
+
#include <Core/SpawningKit/Exceptions.h>
|
65
|
+
#include <Core/SpawningKit/Handshake/Session.h>
|
66
|
+
#include <Core/SpawningKit/Handshake/WorkDir.h>
|
67
|
+
|
68
|
+
namespace Passenger {
|
69
|
+
namespace SpawningKit {
|
70
|
+
|
71
|
+
using namespace std;
|
72
|
+
using namespace oxt;
|
73
|
+
|
74
|
+
|
75
|
+
/**
|
76
|
+
* For an introduction see README.md, section
|
77
|
+
* "The preparation and the HandshakePrepare class".
|
78
|
+
*/
|
79
|
+
class HandshakePrepare {
|
80
|
+
private:
|
81
|
+
HandshakeSession &session;
|
82
|
+
Context * const context;
|
83
|
+
Config * const config;
|
84
|
+
Json::Value args;
|
85
|
+
Timer<SystemTime::GRAN_10MSEC> timer;
|
86
|
+
|
87
|
+
|
88
|
+
void resolveUserAndGroup() {
|
89
|
+
TRACE_POINT();
|
90
|
+
string username = config->user.toString(); // null terminate string
|
91
|
+
string groupname = config->group.toString(); // null terminate string
|
92
|
+
struct passwd pwd, *userInfo;
|
93
|
+
struct group grp, *groupInfo;
|
94
|
+
long pwdBufSize, grpBufSize;
|
95
|
+
boost::scoped_array<char> pwdBuf, grpBuf;
|
96
|
+
int ret;
|
97
|
+
|
98
|
+
// _SC_GETPW_R_SIZE_MAX/_SC_GETGR_R_SIZE_MAX are not maximums:
|
99
|
+
// http://tomlee.co/2012/10/problems-with-large-linux-unix-groups-and-getgrgid_r-getgrnam_r/
|
100
|
+
pwdBufSize = std::max<long>(1024 * 128, sysconf(_SC_GETPW_R_SIZE_MAX));
|
101
|
+
pwdBuf.reset(new char[pwdBufSize]);
|
102
|
+
grpBufSize = std::max<long>(1024 * 128, sysconf(_SC_GETGR_R_SIZE_MAX));
|
103
|
+
grpBuf.reset(new char[grpBufSize]);
|
104
|
+
|
105
|
+
ret = getpwnam_r(username.c_str(), &pwd, pwdBuf.get(), pwdBufSize,
|
106
|
+
&userInfo);
|
107
|
+
if (ret != 0) {
|
108
|
+
if (looksLikePositiveNumber(username)) {
|
109
|
+
P_WARN("Error looking up system user database entry for user '"
|
110
|
+
<< username << "'. Will assume that this is a UID. Error message: "
|
111
|
+
<< strerror(ret) << " (errno=" << ret << ")");
|
112
|
+
session.uid = (uid_t) atoi(username);
|
113
|
+
} else {
|
114
|
+
throw SystemException("Cannot lookup up system user database entry"
|
115
|
+
" for user '" + username + "'", ret);
|
116
|
+
}
|
117
|
+
} else if (userInfo == NULL) {
|
118
|
+
throw RuntimeException("The operating system user '" + username + "' does not exist");
|
119
|
+
} else {
|
120
|
+
session.uid = userInfo->pw_uid;
|
121
|
+
session.shell = userInfo->pw_shell;
|
122
|
+
session.homedir = userInfo->pw_dir;
|
123
|
+
}
|
124
|
+
|
125
|
+
ret = getgrnam_r(groupname.c_str(), &grp, grpBuf.get(), grpBufSize,
|
126
|
+
&groupInfo);
|
127
|
+
if (ret != 0) {
|
128
|
+
if (looksLikePositiveNumber(groupname)) {
|
129
|
+
P_WARN("Error looking up system group database entry for group '"
|
130
|
+
<< groupname << "'. Will assume that this is a GID. Error message: "
|
131
|
+
<< strerror(ret) << " (errno=" << ret << ")");
|
132
|
+
session.gid = (gid_t) atoi(groupname);
|
133
|
+
} else {
|
134
|
+
throw SystemException("Cannot lookup up system group database entry"
|
135
|
+
" for group '" + groupname + "'", ret);
|
136
|
+
}
|
137
|
+
} else if (groupInfo == NULL) {
|
138
|
+
throw RuntimeException("The operating system group '" + groupname + "' does not exist");
|
139
|
+
} else {
|
140
|
+
session.gid = groupInfo->gr_gid;
|
141
|
+
}
|
142
|
+
}
|
143
|
+
|
144
|
+
void createWorkDir() {
|
145
|
+
TRACE_POINT();
|
146
|
+
session.workDir.reset(new HandshakeWorkDir(session.uid, session.gid));
|
147
|
+
|
148
|
+
session.envDumpDir = session.workDir->getPath() + "/envdump";
|
149
|
+
makeDirTree(session.envDumpDir,
|
150
|
+
"u=rwx,g=,o=",
|
151
|
+
session.uid,
|
152
|
+
session.gid);
|
153
|
+
makeDirTree(session.envDumpDir + "/annotations",
|
154
|
+
"u=rwx,g=,o=",
|
155
|
+
session.uid,
|
156
|
+
session.gid);
|
157
|
+
|
158
|
+
session.responseDir = session.workDir->getPath() + "/response";
|
159
|
+
makeDirTree(session.responseDir,
|
160
|
+
"u=rwx,g=,o=",
|
161
|
+
session.uid,
|
162
|
+
session.gid);
|
163
|
+
createFifo(session.responseDir + "/finish");
|
164
|
+
makeDirTree(session.responseDir + "/error",
|
165
|
+
"u=rwx,g=,o=",
|
166
|
+
session.uid,
|
167
|
+
session.gid);
|
168
|
+
makeDirTree(session.responseDir + "/steps",
|
169
|
+
"u=rwx,g=,o=",
|
170
|
+
session.uid,
|
171
|
+
session.gid);
|
172
|
+
|
173
|
+
|
174
|
+
createJourneyStepDirs(getFirstSubprocessJourneyStep(),
|
175
|
+
getLastSubprocessJourneyStep());
|
176
|
+
createJourneyStepDirs(getFirstPreloaderJourneyStep(),
|
177
|
+
// Also create directory for PRELOADER_FINISH;
|
178
|
+
// the preloader will want to write there.
|
179
|
+
JourneyStep((int) getLastPreloaderJourneyStep() + 1));
|
180
|
+
}
|
181
|
+
|
182
|
+
void createJourneyStepDirs(JourneyStep firstStep, JourneyStep lastStep) {
|
183
|
+
JourneyStep step;
|
184
|
+
|
185
|
+
for (step = firstStep; step < lastStep; step = JourneyStep((int) step + 1)) {
|
186
|
+
if (!session.journey.hasStep(step)) {
|
187
|
+
continue;
|
188
|
+
}
|
189
|
+
|
190
|
+
string stepString = journeyStepToStringLowerCase(step);
|
191
|
+
string stepDir = session.responseDir + "/steps/" + stepString;
|
192
|
+
makeDirTree(stepDir, "u=rwx,g=,o=", session.uid, session.gid);
|
193
|
+
}
|
194
|
+
}
|
195
|
+
|
196
|
+
void createFifo(const string &path) {
|
197
|
+
int ret;
|
198
|
+
|
199
|
+
do {
|
200
|
+
ret = mkfifo(path.c_str(), 0600);
|
201
|
+
} while (ret == -1 && errno == EINTR);
|
202
|
+
if (ret == -1) {
|
203
|
+
int e = errno;
|
204
|
+
throw FileSystemException("Cannot create FIFO file " + path,
|
205
|
+
e, path);
|
206
|
+
}
|
207
|
+
|
208
|
+
ret = syscalls::chown(path.c_str(),
|
209
|
+
session.uid,
|
210
|
+
session.gid);
|
211
|
+
if (ret == -1) {
|
212
|
+
int e = errno;
|
213
|
+
throw FileSystemException(
|
214
|
+
"Cannot change ownership for FIFO file " + path,
|
215
|
+
e, path);
|
216
|
+
}
|
217
|
+
}
|
218
|
+
|
219
|
+
void initializeResult() {
|
220
|
+
session.result.initialize(*context, config);
|
221
|
+
}
|
222
|
+
|
223
|
+
void preparePredefinedArgs() {
|
224
|
+
TRACE_POINT();
|
225
|
+
struct sockaddr_un addr;
|
226
|
+
|
227
|
+
args["passenger_root"] = context->resourceLocator->getInstallSpec();
|
228
|
+
args["passenger_version"] = PASSENGER_VERSION;
|
229
|
+
args["passenger_agent_path"] = context->resourceLocator->findSupportBinary(AGENT_EXE);
|
230
|
+
args["ruby_libdir"] = context->resourceLocator->getRubyLibDir();
|
231
|
+
args["node_libdir"] = context->resourceLocator->getNodeLibDir();
|
232
|
+
args["integration_mode"] = context->integrationMode;
|
233
|
+
args["gupid"] = session.result.gupid;
|
234
|
+
args["UNIX_PATH_MAX"] = (Json::UInt64) sizeof(addr.sun_path) - 1;
|
235
|
+
if (config->genericApp || config->findFreePort) {
|
236
|
+
args["expected_start_port"] = session.expectedStartPort;
|
237
|
+
}
|
238
|
+
if (!config->apiKey.empty()) {
|
239
|
+
args["connect_password"] = config->apiKey.toString();
|
240
|
+
}
|
241
|
+
if (!context->instanceDir.empty()) {
|
242
|
+
args["instance_dir"] = context->instanceDir;
|
243
|
+
args["socket_dir"] = context->instanceDir + "/apps.s";
|
244
|
+
}
|
245
|
+
}
|
246
|
+
|
247
|
+
void prepareArgsFromAppConfig() {
|
248
|
+
TRACE_POINT();
|
249
|
+
const Json::Value appConfigJson = config->getConfidentialFieldsToPassToApp();
|
250
|
+
Json::Value::const_iterator it, end = appConfigJson.end();
|
251
|
+
for (it = appConfigJson.begin(); it != end; it++) {
|
252
|
+
args[it.name()] = *it;
|
253
|
+
}
|
254
|
+
}
|
255
|
+
|
256
|
+
void absolutizeKeyArgPaths() {
|
257
|
+
TRACE_POINT();
|
258
|
+
args["app_root"] = absolutizePath(args["app_root"].asString());
|
259
|
+
if (args.isMember("startup_file")) {
|
260
|
+
args["startup_file"] = absolutizePath(args["startup_file"].asString(),
|
261
|
+
args["app_root"].asString());
|
262
|
+
}
|
263
|
+
}
|
264
|
+
|
265
|
+
void dumpArgsIntoWorkDir() {
|
266
|
+
TRACE_POINT();
|
267
|
+
P_DEBUG("[App spawn arg] " << args.toStyledString());
|
268
|
+
|
269
|
+
createFile(session.workDir->getPath() + "/args.json",
|
270
|
+
args.toStyledString(), 0600,
|
271
|
+
session.uid, session.gid,
|
272
|
+
true, __FILE__, __LINE__);
|
273
|
+
|
274
|
+
const string dir = session.workDir->getPath() + "/args";
|
275
|
+
makeDirTree(dir, "u=rwx,g=,o=",
|
276
|
+
session.uid,
|
277
|
+
session.gid);
|
278
|
+
|
279
|
+
const Json::Value &constArgs = const_cast<const Json::Value &>(args);
|
280
|
+
Json::Value::const_iterator it, end = constArgs.end();
|
281
|
+
for (it = constArgs.begin(); it != end; it++) {
|
282
|
+
const Json::Value &value = *it;
|
283
|
+
switch (value.type()) {
|
284
|
+
case Json::nullValue:
|
285
|
+
case Json::intValue:
|
286
|
+
case Json::uintValue:
|
287
|
+
case Json::realValue:
|
288
|
+
case Json::stringValue:
|
289
|
+
case Json::booleanValue:
|
290
|
+
createFile(dir + "/" + it.name(),
|
291
|
+
jsonValueToString(*it),
|
292
|
+
0644, session.uid, session.gid,
|
293
|
+
true, __FILE__, __LINE__);
|
294
|
+
break;
|
295
|
+
default:
|
296
|
+
createFile(dir + "/" + it.name() + ".json",
|
297
|
+
jsonValueToString(*it),
|
298
|
+
0644, session.uid, session.gid,
|
299
|
+
true, __FILE__, __LINE__);
|
300
|
+
break;
|
301
|
+
}
|
302
|
+
}
|
303
|
+
}
|
304
|
+
|
305
|
+
string jsonValueToString(const Json::Value &value) const {
|
306
|
+
switch (value.type()) {
|
307
|
+
case Json::nullValue:
|
308
|
+
return string();
|
309
|
+
case Json::intValue:
|
310
|
+
return toString(value.asInt64());
|
311
|
+
case Json::uintValue:
|
312
|
+
return toString(value.asUInt64());
|
313
|
+
case Json::realValue:
|
314
|
+
return toString(value.asDouble());
|
315
|
+
case Json::stringValue:
|
316
|
+
return value.asString();
|
317
|
+
case Json::booleanValue:
|
318
|
+
if (value.asBool()) {
|
319
|
+
return "true";
|
320
|
+
} else {
|
321
|
+
return "false";
|
322
|
+
}
|
323
|
+
default:
|
324
|
+
return value.toStyledString();
|
325
|
+
}
|
326
|
+
}
|
327
|
+
|
328
|
+
#if 0
|
329
|
+
void inferApplicationInfo() const {
|
330
|
+
TRACE_POINT();
|
331
|
+
session.result.codeRevision = readFromRevisionFile();
|
332
|
+
if (session.result.codeRevision.empty()) {
|
333
|
+
session.result.codeRevision = inferCodeRevisionFromCapistranoSymlink();
|
334
|
+
}
|
335
|
+
}
|
336
|
+
|
337
|
+
string readFromRevisionFile() const {
|
338
|
+
TRACE_POINT();
|
339
|
+
string filename = config->appRoot + "/REVISION";
|
340
|
+
try {
|
341
|
+
if (fileExists(filename)) {
|
342
|
+
return strip(readAll(filename));
|
343
|
+
}
|
344
|
+
} catch (const SystemException &e) {
|
345
|
+
P_WARN("Cannot access " << filename << ": " << e.what());
|
346
|
+
}
|
347
|
+
return string();
|
348
|
+
}
|
349
|
+
|
350
|
+
string inferCodeRevisionFromCapistranoSymlink() const {
|
351
|
+
TRACE_POINT();
|
352
|
+
if (extractBaseName(config->appRoot) == "current") {
|
353
|
+
string appRoot = config->appRoot.toString(); // null terminate string
|
354
|
+
char buf[PATH_MAX + 1];
|
355
|
+
ssize_t ret;
|
356
|
+
|
357
|
+
do {
|
358
|
+
ret = readlink(appRoot.c_str(), buf, PATH_MAX);
|
359
|
+
} while (ret == -1 && errno == EINTR);
|
360
|
+
if (ret == -1) {
|
361
|
+
if (errno == EINVAL) {
|
362
|
+
return string();
|
363
|
+
} else {
|
364
|
+
int e = errno;
|
365
|
+
P_WARN("Cannot read symlink " << appRoot << ": " << strerror(e));
|
366
|
+
}
|
367
|
+
}
|
368
|
+
|
369
|
+
buf[ret] = '\0';
|
370
|
+
return extractBaseName(buf);
|
371
|
+
} else {
|
372
|
+
return string();
|
373
|
+
}
|
374
|
+
}
|
375
|
+
#endif
|
376
|
+
|
377
|
+
void findFreePortOrSocketFile() {
|
378
|
+
TRACE_POINT();
|
379
|
+
session.expectedStartPort = findFreePort();
|
380
|
+
if (session.expectedStartPort == 0) {
|
381
|
+
throwSpawnExceptionBecauseOfFailureToFindFreePort();
|
382
|
+
}
|
383
|
+
|
384
|
+
// TODO: support Unix domain sockets in the future
|
385
|
+
// session.expectedStartSocketFile = findFreeSocketFile();
|
386
|
+
}
|
387
|
+
|
388
|
+
unsigned int findFreePort() {
|
389
|
+
TRACE_POINT();
|
390
|
+
unsigned int tryCount = 1;
|
391
|
+
unsigned int maxTries;
|
392
|
+
|
393
|
+
while (true) {
|
394
|
+
unsigned int port;
|
395
|
+
|
396
|
+
boost::this_thread::interruption_point();
|
397
|
+
|
398
|
+
{
|
399
|
+
boost::lock_guard<boost::mutex> l(context->syncher);
|
400
|
+
port = context->nextPort;
|
401
|
+
context->nextPort++;
|
402
|
+
if (context->nextPort > context->maxPortRange) {
|
403
|
+
context->nextPort = context->minPortRange;
|
404
|
+
}
|
405
|
+
maxTries = context->maxPortRange -
|
406
|
+
context->minPortRange + 1;
|
407
|
+
}
|
408
|
+
|
409
|
+
unsigned long long timeout1 = 100000;
|
410
|
+
unsigned long long timeout2 = 100000;
|
411
|
+
|
412
|
+
if (!pingTcpServer("127.0.0.1", port, &timeout1)
|
413
|
+
&& !pingTcpServer("0.0.0.0", port, &timeout2))
|
414
|
+
{
|
415
|
+
return port;
|
416
|
+
} else if (tryCount >= maxTries) {
|
417
|
+
return 0;
|
418
|
+
} else if (timer.usecElapsed() >= session.timeoutUsec) {
|
419
|
+
throwSpawnExceptionBecauseOfPortFindingTimeout();
|
420
|
+
} // else: try again
|
421
|
+
}
|
422
|
+
}
|
423
|
+
|
424
|
+
void adjustTimeout() {
|
425
|
+
unsigned long long elapsed = timer.usecElapsed();
|
426
|
+
|
427
|
+
if (elapsed >= session.timeoutUsec) {
|
428
|
+
session.timeoutUsec = 0;
|
429
|
+
} else {
|
430
|
+
session.timeoutUsec -= elapsed;
|
431
|
+
}
|
432
|
+
}
|
433
|
+
|
434
|
+
void throwSpawnExceptionBecauseOfPortFindingTimeout() {
|
435
|
+
assert(config->genericApp || config->findFreePort);
|
436
|
+
SpawnException e(TIMEOUT_ERROR, session.journey, config);
|
437
|
+
e.setProblemDescriptionHTML(
|
438
|
+
"<p>The " PROGRAM_NAME " application server tried"
|
439
|
+
" to look for a free TCP port for the web application"
|
440
|
+
" to start on. But this took too much time, so "
|
441
|
+
SHORT_PROGRAM_NAME " put a stop to that.</p>");
|
442
|
+
|
443
|
+
unsigned int minPortRange, maxPortRange;
|
444
|
+
{
|
445
|
+
boost::lock_guard<boost::mutex> l(context->syncher);
|
446
|
+
minPortRange = context->minPortRange;
|
447
|
+
maxPortRange = context->maxPortRange;
|
448
|
+
}
|
449
|
+
|
450
|
+
e.setSolutionDescriptionHTML(
|
451
|
+
"<div class=\"multiple-solutions\">"
|
452
|
+
|
453
|
+
"<h3>Check whether the server is low on resources</h3>"
|
454
|
+
"<p>Maybe the server is currently so low on resources that"
|
455
|
+
" all the work that needed to be done, could not finish within"
|
456
|
+
" the given time limit."
|
457
|
+
" Please inspect the server resource utilization statistics"
|
458
|
+
" in the <em>diagnostics</em> section to verify"
|
459
|
+
" whether server is indeed low on resources.</p>"
|
460
|
+
"<p>If so, then either increase the spawn timeout (currently"
|
461
|
+
" configured at " + toString(config->startTimeoutMsec / 1000)
|
462
|
+
+ " sec), or find a way to lower the server's resource"
|
463
|
+
" utilization.</p>"
|
464
|
+
|
465
|
+
"<h3>Limit the port range that " SHORT_PROGRAM_NAME " searches in</h3>"
|
466
|
+
"<p>Maybe the port range in which " SHORT_PROGRAM_NAME
|
467
|
+
" tried to search for a free port for the application is"
|
468
|
+
" large, and at the same time there were very few free ports"
|
469
|
+
" available.</p>"
|
470
|
+
"<p>If this is the case, then please configure the "
|
471
|
+
SHORT_PROGRAM_NAME " application spawning port range"
|
472
|
+
" to a range that is known to have many free ports. The port"
|
473
|
+
" range is currently configured at " + toString(minPortRange)
|
474
|
+
+ "-" + toString(maxPortRange) + ".</p>"
|
475
|
+
|
476
|
+
"</div>"
|
477
|
+
);
|
478
|
+
|
479
|
+
throw e.finalize();
|
480
|
+
}
|
481
|
+
|
482
|
+
void throwSpawnExceptionBecauseOfFailureToFindFreePort() {
|
483
|
+
assert(config->genericApp || config->findFreePort);
|
484
|
+
unsigned int minPortRange, maxPortRange;
|
485
|
+
{
|
486
|
+
boost::lock_guard<boost::mutex> l(context->syncher);
|
487
|
+
minPortRange = context->minPortRange;
|
488
|
+
maxPortRange = context->maxPortRange;
|
489
|
+
}
|
490
|
+
|
491
|
+
SpawnException e(INTERNAL_ERROR, session.journey, config);
|
492
|
+
e.setSummary("Could not find a free port to spawn the application on.");
|
493
|
+
e.setProblemDescriptionHTML(
|
494
|
+
"<p>The " PROGRAM_NAME " application server tried"
|
495
|
+
" to look for a free TCP port for the web application"
|
496
|
+
" to start on, but was unable to find one.</p>");
|
497
|
+
e.setSolutionDescriptionHTML(
|
498
|
+
"<div class=\"sole-solutions\">"
|
499
|
+
|
500
|
+
"<p>Maybe the port range in which " SHORT_PROGRAM_NAME
|
501
|
+
" tried to search for a free port, had very few or no"
|
502
|
+
" free ports.</p>"
|
503
|
+
"<p>If this is the case, then please configure the "
|
504
|
+
SHORT_PROGRAM_NAME " application spawning port range"
|
505
|
+
" to a range that is known to have many free ports. The port"
|
506
|
+
" range is currently configured at " + toString(minPortRange)
|
507
|
+
+ "-" + toString(maxPortRange) + ".</p>"
|
508
|
+
|
509
|
+
"</div>");
|
510
|
+
throw e.finalize();
|
511
|
+
}
|
512
|
+
|
513
|
+
public:
|
514
|
+
struct DebugSupport {
|
515
|
+
virtual ~DebugSupport() { }
|
516
|
+
virtual void beforeAdjustTimeout() { }
|
517
|
+
};
|
518
|
+
|
519
|
+
DebugSupport *debugSupport;
|
520
|
+
|
521
|
+
|
522
|
+
HandshakePrepare(HandshakeSession &_session,
|
523
|
+
const Json::Value &extraArgs = Json::Value())
|
524
|
+
: session(_session),
|
525
|
+
context(_session.context),
|
526
|
+
config(_session.config),
|
527
|
+
args(extraArgs),
|
528
|
+
timer(false),
|
529
|
+
debugSupport(NULL)
|
530
|
+
{
|
531
|
+
assert(_session.context != NULL);
|
532
|
+
assert(_session.context->isFinalized());
|
533
|
+
assert(_session.config != NULL);
|
534
|
+
}
|
535
|
+
|
536
|
+
void execute() {
|
537
|
+
TRACE_POINT();
|
538
|
+
|
539
|
+
// We do not set SPAWNING_KIT_PREPARATION to the IN_PROGRESS or
|
540
|
+
// PERFORMED state here. That will be done by the caller because
|
541
|
+
// it may want to perform additional preparation.
|
542
|
+
|
543
|
+
try {
|
544
|
+
timer.start();
|
545
|
+
|
546
|
+
resolveUserAndGroup();
|
547
|
+
createWorkDir();
|
548
|
+
initializeResult();
|
549
|
+
|
550
|
+
UPDATE_TRACE_POINT();
|
551
|
+
// Disabled to fix CVE-2017-16355
|
552
|
+
//inferApplicationInfo();
|
553
|
+
if (config->genericApp || config->findFreePort) {
|
554
|
+
findFreePortOrSocketFile();
|
555
|
+
}
|
556
|
+
|
557
|
+
UPDATE_TRACE_POINT();
|
558
|
+
preparePredefinedArgs();
|
559
|
+
prepareArgsFromAppConfig();
|
560
|
+
absolutizeKeyArgPaths();
|
561
|
+
dumpArgsIntoWorkDir();
|
562
|
+
|
563
|
+
if (debugSupport != NULL) {
|
564
|
+
debugSupport->beforeAdjustTimeout();
|
565
|
+
}
|
566
|
+
|
567
|
+
adjustTimeout();
|
568
|
+
} catch (const SpawnException &) {
|
569
|
+
session.journey.setStepErrored(SPAWNING_KIT_PREPARATION);
|
570
|
+
throw;
|
571
|
+
} catch (const std::exception &e) {
|
572
|
+
session.journey.setStepErrored(SPAWNING_KIT_PREPARATION);
|
573
|
+
throw SpawnException(e, session.journey, config).finalize();
|
574
|
+
}
|
575
|
+
}
|
576
|
+
};
|
577
|
+
|
578
|
+
|
579
|
+
} // namespace SpawningKit
|
580
|
+
} // namespace Passenger
|
581
|
+
|
582
|
+
#endif /* _PASSENGER_SPAWNING_KIT_HANDSHAKE_PREPARE_H_ */
|