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
@@ -117,8 +117,8 @@ vm.runInThisContext = function() {
|
|
117
117
|
return orig_func.apply(this, arguments);
|
118
118
|
};
|
119
119
|
|
120
|
+
|
120
121
|
var LineReader = require('phusion_passenger/line_reader').LineReader;
|
121
|
-
var ustLog = require('phusion_passenger/ustrouter_connector');
|
122
122
|
|
123
123
|
var instrumentModulePaths = [ 'phusion_passenger/log_express', 'phusion_passenger/log_mongodb'];
|
124
124
|
var instrumentedModules = [];
|
@@ -126,44 +126,42 @@ var instrumentedModules = [];
|
|
126
126
|
module.isApplicationLoader = true; // https://groups.google.com/forum/#!topic/compoundjs/4txxkNtROQg
|
127
127
|
global.PhusionPassenger = exports.PhusionPassenger = new EventEmitter();
|
128
128
|
var stdinReader = new LineReader(process.stdin);
|
129
|
-
beginHandshake();
|
130
|
-
readInitializationHeader();
|
131
129
|
|
130
|
+
recordJourneyStepEnd('SUBPROCESS_EXEC_WRAPPER', 'STEP_PERFORMED');
|
131
|
+
recordJourneyStepBegin('SUBPROCESS_WRAPPER_PREPARATION', 'STEP_IN_PROGRESS');
|
132
|
+
var options = readStartupArguments();
|
133
|
+
setupEnvironment(options);
|
132
134
|
|
133
|
-
function beginHandshake() {
|
134
|
-
process.stdout.write("!> I have control 1.0\n");
|
135
|
-
}
|
136
135
|
|
137
|
-
function
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
readOptions();
|
144
|
-
}
|
145
|
-
});
|
136
|
+
function tryWriteFile(path, contents) {
|
137
|
+
try {
|
138
|
+
fs.writeFileSync(path, contents);
|
139
|
+
} catch (e) {
|
140
|
+
console.error('Warning: unable to write to ' + path + ': ' + e.message);
|
141
|
+
}
|
146
142
|
}
|
147
143
|
|
148
|
-
function
|
149
|
-
var
|
144
|
+
function recordJourneyStepBegin(step, state) {
|
145
|
+
var workDir = process.env['PASSENGER_SPAWN_WORK_DIR'];
|
146
|
+
var stepDir = workDir + '/response/steps/' + step.toLowerCase();
|
147
|
+
tryWriteFile(stepDir + '/state', 'STEP_IN_PROGRESS');
|
148
|
+
tryWriteFile(stepDir + '/begin_time', Date.now() / 1000);
|
149
|
+
}
|
150
150
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
process.exit(1);
|
158
|
-
} else {
|
159
|
-
var matches = line.replace(/\n/, '').match(/(.*?) *: *(.*)/);
|
160
|
-
options[matches[1]] = matches[2];
|
161
|
-
readNextOption();
|
162
|
-
}
|
163
|
-
});
|
151
|
+
function recordJourneyStepEnd(step, state) {
|
152
|
+
var workDir = process.env['PASSENGER_SPAWN_WORK_DIR'];
|
153
|
+
var stepDir = workDir + '/response/steps/' + step.toLowerCase();
|
154
|
+
tryWriteFile(stepDir + '/state', 'STEP_IN_PROGRESS');
|
155
|
+
if (!fs.existsSync(stepDir + '/begin_time') && !fs.existsSync(stepDir + '/begin_time_monotonic')) {
|
156
|
+
tryWriteFile(stepDir + '/begin_time', Date.now() / 1000);
|
164
157
|
}
|
158
|
+
tryWriteFile(stepDir + '/end_time', Date.now() / 1000);
|
159
|
+
}
|
165
160
|
|
166
|
-
|
161
|
+
function readStartupArguments() {
|
162
|
+
var workDir = process.env['PASSENGER_SPAWN_WORK_DIR'];
|
163
|
+
var doc = fs.readFileSync(workDir + '/args.json');
|
164
|
+
return JSON.parse(doc);
|
167
165
|
}
|
168
166
|
|
169
167
|
function passengerToWinstonLogLevel(passengerLogLevel) {
|
@@ -206,35 +204,14 @@ function setupEnvironment(options) {
|
|
206
204
|
http.Server.prototype.originalListen = http.Server.prototype.listen;
|
207
205
|
http.Server.prototype.listen = installServer;
|
208
206
|
|
209
|
-
ustLog.init(logger, PhusionPassenger.options.ust_router_address, PhusionPassenger.options.ust_router_username,
|
210
|
-
PhusionPassenger.options.ust_router_password, PhusionPassenger.options.union_station_key, PhusionPassenger.options.app_group_name);
|
211
|
-
|
212
|
-
if (ustLog.isEnabled()) {
|
213
|
-
// must be first so other modules can use the cls context
|
214
|
-
require('vendor-copy/continuation-local-storage').createNamespace('passenger-request-ctx');
|
215
|
-
|
216
|
-
global.phusion_passenger_ustReporter = require('phusion_passenger/ustreporter');
|
217
|
-
global.phusion_passenger_ustReporter.init(logger, options.app_root, ustLog);
|
218
|
-
|
219
|
-
instrumentModulePaths.forEach(function(modulePath) {
|
220
|
-
var module = require(modulePath);
|
221
|
-
instrumentedModules.push(module);
|
222
|
-
module.initPreLoad(logger, options.app_root, ustLog);
|
223
|
-
});
|
224
|
-
}
|
225
|
-
|
226
207
|
stdinReader.close();
|
227
208
|
stdinReader = undefined;
|
228
209
|
process.stdin.on('end', shutdown);
|
229
210
|
process.stdin.resume();
|
230
211
|
|
212
|
+
recordJourneyStepEnd('SUBPROCESS_WRAPPER_PREPARATION', 'STEP_PERFORMED');
|
213
|
+
recordJourneyStepBegin('SUBPROCESS_APP_LOAD_OR_EXEC', 'STEP_IN_PROGRESS');
|
231
214
|
loadApplication();
|
232
|
-
|
233
|
-
if (ustLog.isEnabled()) {
|
234
|
-
instrumentedModules.forEach(function(module) {
|
235
|
-
module.initPostLoad();
|
236
|
-
});
|
237
|
-
}
|
238
215
|
}
|
239
216
|
|
240
217
|
/**
|
@@ -339,6 +316,9 @@ function installServer() {
|
|
339
316
|
PhusionPassenger._appInstalled = true;
|
340
317
|
PhusionPassenger._server = server;
|
341
318
|
|
319
|
+
recordJourneyStepEnd('SUBPROCESS_APP_LOAD_OR_EXEC', 'STEP_PERFORMED');
|
320
|
+
recordJourneyStepBegin('SUBPROCESS_LISTEN', 'STEP_IN_PROGRESS');
|
321
|
+
|
342
322
|
// Ensure that req.connection.remoteAddress and remotePort return something
|
343
323
|
// instead of undefined. Apps like Etherpad expect it.
|
344
324
|
// See https://github.com/phusion/passenger/issues/1224
|
@@ -379,11 +359,26 @@ function listenAndMaybeInstall(port) {
|
|
379
359
|
}
|
380
360
|
|
381
361
|
function finalizeStartup() {
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
362
|
+
recordJourneyStepEnd('SUBPROCESS_LISTEN', 'STEP_PERFORMED');
|
363
|
+
|
364
|
+
var workDir = process.env['PASSENGER_SPAWN_WORK_DIR'];
|
365
|
+
|
366
|
+
fs.writeFileSync(workDir + '/response/properties.json', JSON.stringify({
|
367
|
+
sockets: [
|
368
|
+
{
|
369
|
+
name: 'main',
|
370
|
+
address: 'unix:' + PhusionPassenger.options.socket_path,
|
371
|
+
protocol: 'http',
|
372
|
+
concurrency: 0,
|
373
|
+
accept_http_requests: true
|
374
|
+
}
|
375
|
+
]
|
376
|
+
}));
|
377
|
+
|
378
|
+
// fs.writeFileSync() does not work on FIFO files
|
379
|
+
var stream = fs.createWriteStream(workDir + '/response/finish');
|
380
|
+
stream.write('1');
|
381
|
+
stream.close();
|
387
382
|
}
|
388
383
|
|
389
384
|
function shutdown() {
|
@@ -34,61 +34,51 @@ module PhusionPassenger
|
|
34
34
|
@@app
|
35
35
|
end
|
36
36
|
|
37
|
-
def self.
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
result << "\n " << e.backtrace.join("\n ")
|
45
|
-
end
|
37
|
+
def self.init_passenger
|
38
|
+
STDOUT.sync = true
|
39
|
+
STDERR.sync = true
|
40
|
+
|
41
|
+
work_dir = ENV['PASSENGER_SPAWN_WORK_DIR'].to_s
|
42
|
+
if work_dir.empty?
|
43
|
+
abort "This program may only be invoked from Passenger (error: $PASSENGER_SPAWN_WORK_DIR not set)."
|
46
44
|
end
|
47
|
-
|
45
|
+
|
46
|
+
record_journey_step_end('SUBPROCESS_EXEC_WRAPPER', 'STEP_PERFORMED')
|
47
|
+
record_journey_step_begin('SUBPROCESS_WRAPPER_PREPARATION', 'STEP_IN_PROGRESS')
|
48
|
+
|
49
|
+
ruby_libdir = File.read("#{work_dir}/args/ruby_libdir").strip
|
50
|
+
passenger_root = File.read("#{work_dir}/args/passenger_root").strip
|
51
|
+
require "#{ruby_libdir}/phusion_passenger"
|
52
|
+
PhusionPassenger.locate_directories(passenger_root)
|
53
|
+
|
54
|
+
PhusionPassenger.require_passenger_lib 'loader_shared_helpers'
|
48
55
|
end
|
49
56
|
|
50
|
-
def self.
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
57
|
+
def self.try_write_file(path, contents)
|
58
|
+
begin
|
59
|
+
File.open(path, 'wb') do |f|
|
60
|
+
f.write(contents)
|
61
|
+
end
|
62
|
+
rescue SystemCallError => e
|
63
|
+
STDERR.puts "Warning: unable to write to #{path}: #{e}"
|
55
64
|
end
|
56
65
|
end
|
57
66
|
|
58
|
-
def self.
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
@@options = {}
|
65
|
-
while (line = STDIN.readline) != "\n"
|
66
|
-
name, value = line.strip.split(/: */, 2)
|
67
|
-
@@options[name] = value
|
68
|
-
end
|
67
|
+
def self.record_journey_step_begin(step, state)
|
68
|
+
dir = ENV['PASSENGER_SPAWN_WORK_DIR']
|
69
|
+
step_dir = "#{dir}/response/steps/#{step.downcase}"
|
70
|
+
try_write_file("#{step_dir}/state", state)
|
71
|
+
try_write_file("#{step_dir}/begin_time", Time.now.to_f)
|
69
72
|
end
|
70
73
|
|
71
|
-
def self.
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
PhusionPassenger.require_passenger_lib 'loader_shared_helpers'
|
78
|
-
PhusionPassenger.require_passenger_lib 'request_handler'
|
79
|
-
PhusionPassenger.require_passenger_lib 'rack/thread_handler_extension'
|
80
|
-
@@options = LoaderSharedHelpers.init(@@options)
|
81
|
-
if defined?(NativeSupport)
|
82
|
-
NativeSupport.disable_stdio_buffering
|
74
|
+
def self.record_journey_step_end(step, state)
|
75
|
+
dir = ENV['PASSENGER_SPAWN_WORK_DIR']
|
76
|
+
step_dir = "#{dir}/response/steps/#{step.downcase}"
|
77
|
+
try_write_file("#{step_dir}/state", state)
|
78
|
+
if !File.exist?("#{step_dir}/begin_time") && !File.exist?("#{step_dir}/begin_time_monotonic")
|
79
|
+
try_write_file("#{step_dir}/begin_time", Time.now.to_f)
|
83
80
|
end
|
84
|
-
|
85
|
-
rescue Exception => e
|
86
|
-
LoaderSharedHelpers.about_to_abort(options, e) if defined?(LoaderSharedHelpers)
|
87
|
-
puts "!> Error"
|
88
|
-
puts "!> html: true" if e.respond_to?(:html?) && e.html?
|
89
|
-
puts "!> "
|
90
|
-
puts format_exception(e)
|
91
|
-
exit exit_code_for_exception(e)
|
81
|
+
try_write_file("#{step_dir}/end_time", Time.now.to_f)
|
92
82
|
end
|
93
83
|
|
94
84
|
def self.load_app
|
@@ -97,9 +87,9 @@ module PhusionPassenger
|
|
97
87
|
LoaderSharedHelpers.before_loading_app_code_step2(options)
|
98
88
|
LoaderSharedHelpers.activate_gem 'rack'
|
99
89
|
|
100
|
-
app_root = options[
|
90
|
+
app_root = options['app_root']
|
101
91
|
rackup_file = LoaderSharedHelpers.maybe_make_path_relative_to_app_root(
|
102
|
-
app_root, options[
|
92
|
+
app_root, options['startup_file'] || "#{app_root}/config.ru")
|
103
93
|
rackup_code = ::File.open(rackup_file, 'rb') do |f|
|
104
94
|
f.read
|
105
95
|
end
|
@@ -108,26 +98,39 @@ module PhusionPassenger
|
|
108
98
|
|
109
99
|
LoaderSharedHelpers.after_loading_app_code(options)
|
110
100
|
rescue Exception => e
|
101
|
+
LoaderSharedHelpers.record_and_print_exception(e)
|
111
102
|
LoaderSharedHelpers.about_to_abort(options, e)
|
112
|
-
|
113
|
-
puts "!> html: true" if e.respond_to?(:html?) && e.html?
|
114
|
-
puts "!> "
|
115
|
-
puts format_exception(e)
|
116
|
-
exit exit_code_for_exception(e)
|
103
|
+
exit LoaderSharedHelpers.exit_code_for_exception(e)
|
117
104
|
end
|
118
105
|
|
119
106
|
|
120
107
|
################## Main code ##################
|
121
108
|
|
122
109
|
|
123
|
-
handshake_and_read_startup_request
|
124
110
|
init_passenger
|
125
|
-
|
126
|
-
LoaderSharedHelpers.
|
127
|
-
|
128
|
-
|
129
|
-
LoaderSharedHelpers.
|
130
|
-
|
111
|
+
@@options = LoaderSharedHelpers.init(self)
|
112
|
+
LoaderSharedHelpers.record_journey_step_end('SUBPROCESS_WRAPPER_PREPARATION',
|
113
|
+
'STEP_PERFORMED')
|
114
|
+
|
115
|
+
LoaderSharedHelpers.run_block_and_record_step_progress('SUBPROCESS_APP_LOAD_OR_EXEC') do
|
116
|
+
load_app
|
117
|
+
end
|
118
|
+
|
119
|
+
handler = nil
|
120
|
+
LoaderSharedHelpers.run_block_and_record_step_progress('SUBPROCESS_LISTEN') do
|
121
|
+
begin
|
122
|
+
LoaderSharedHelpers.before_handling_requests(false, options)
|
123
|
+
handler = RequestHandler.new(STDIN, options.merge('app' => app))
|
124
|
+
LoaderSharedHelpers.advertise_sockets(options, handler)
|
125
|
+
rescue Exception => e
|
126
|
+
LoaderSharedHelpers.record_and_print_exception(e)
|
127
|
+
LoaderSharedHelpers.about_to_abort(options, e)
|
128
|
+
exit LoaderSharedHelpers.exit_code_for_exception(e)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
LoaderSharedHelpers.advertise_readiness(options)
|
133
|
+
|
131
134
|
handler.main_loop
|
132
135
|
handler.cleanup
|
133
136
|
LoaderSharedHelpers.after_handling_requests
|
@@ -36,63 +36,54 @@ module PhusionPassenger
|
|
36
36
|
@@app
|
37
37
|
end
|
38
38
|
|
39
|
-
def self.
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
result << "\n " << e.backtrace.join("\n ")
|
47
|
-
end
|
39
|
+
def self.init_passenger
|
40
|
+
STDOUT.sync = true
|
41
|
+
STDERR.sync = true
|
42
|
+
|
43
|
+
work_dir = ENV['PASSENGER_SPAWN_WORK_DIR'].to_s
|
44
|
+
if work_dir.empty?
|
45
|
+
abort "This program may only be invoked from Passenger (error: $PASSENGER_SPAWN_WORK_DIR not set)."
|
48
46
|
end
|
49
|
-
|
47
|
+
|
48
|
+
record_journey_step_end('SUBPROCESS_EXEC_WRAPPER', 'STEP_PERFORMED')
|
49
|
+
record_journey_step_begin('SUBPROCESS_WRAPPER_PREPARATION', 'STEP_IN_PROGRESS')
|
50
|
+
|
51
|
+
ruby_libdir = File.read("#{work_dir}/args/ruby_libdir").strip
|
52
|
+
passenger_root = File.read("#{work_dir}/args/passenger_root").strip
|
53
|
+
require "#{ruby_libdir}/phusion_passenger"
|
54
|
+
PhusionPassenger.locate_directories(passenger_root)
|
55
|
+
|
56
|
+
PhusionPassenger.require_passenger_lib 'loader_shared_helpers'
|
57
|
+
PhusionPassenger.require_passenger_lib 'preloader_shared_helpers'
|
58
|
+
PhusionPassenger.require_passenger_lib 'utils/json'
|
59
|
+
require 'socket'
|
50
60
|
end
|
51
61
|
|
52
|
-
def self.
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
62
|
+
def self.try_write_file(path, contents)
|
63
|
+
begin
|
64
|
+
File.open(path, 'wb') do |f|
|
65
|
+
f.write(contents)
|
66
|
+
end
|
67
|
+
rescue SystemCallError => e
|
68
|
+
STDERR.puts "Warning: unable to write to #{path}: #{e}"
|
57
69
|
end
|
58
70
|
end
|
59
71
|
|
60
|
-
def self.
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
@@options = {}
|
67
|
-
while (line = STDIN.readline) != "\n"
|
68
|
-
name, value = line.strip.split(/: */, 2)
|
69
|
-
@@options[name] = value
|
70
|
-
end
|
72
|
+
def self.record_journey_step_begin(step, state, work_dir = nil)
|
73
|
+
dir = work_dir || ENV['PASSENGER_SPAWN_WORK_DIR']
|
74
|
+
step_dir = "#{dir}/response/steps/#{step.downcase}"
|
75
|
+
try_write_file("#{step_dir}/state", state)
|
76
|
+
try_write_file("#{step_dir}/begin_time", Time.now.to_f)
|
71
77
|
end
|
72
78
|
|
73
|
-
def self.
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
PhusionPassenger.require_passenger_lib 'preloader_shared_helpers'
|
80
|
-
PhusionPassenger.require_passenger_lib 'loader_shared_helpers'
|
81
|
-
PhusionPassenger.require_passenger_lib 'request_handler'
|
82
|
-
PhusionPassenger.require_passenger_lib 'rack/thread_handler_extension'
|
83
|
-
@@options = LoaderSharedHelpers.init(@@options)
|
84
|
-
@@options = PreloaderSharedHelpers.init(@@options)
|
85
|
-
if defined?(NativeSupport)
|
86
|
-
NativeSupport.disable_stdio_buffering
|
79
|
+
def self.record_journey_step_end(step, state, work_dir = nil)
|
80
|
+
dir = work_dir || ENV['PASSENGER_SPAWN_WORK_DIR']
|
81
|
+
step_dir = "#{dir}/response/steps/#{step.downcase}"
|
82
|
+
try_write_file("#{step_dir}/state", state)
|
83
|
+
if !File.exist?("#{step_dir}/begin_time") && !File.exist?("#{step_dir}/begin_time_monotonic")
|
84
|
+
try_write_file("#{step_dir}/begin_time", Time.now.to_f)
|
87
85
|
end
|
88
|
-
|
89
|
-
rescue Exception => e
|
90
|
-
LoaderSharedHelpers.about_to_abort(options, e) if defined?(LoaderSharedHelpers)
|
91
|
-
puts "!> Error"
|
92
|
-
puts "!> html: true" if e.respond_to?(:html?) && e.html?
|
93
|
-
puts "!> "
|
94
|
-
puts format_exception(e)
|
95
|
-
exit exit_code_for_exception(e)
|
86
|
+
try_write_file("#{step_dir}/end_time", Time.now.to_f)
|
96
87
|
end
|
97
88
|
|
98
89
|
def self.preload_app
|
@@ -112,38 +103,76 @@ module PhusionPassenger
|
|
112
103
|
|
113
104
|
LoaderSharedHelpers.after_loading_app_code(options)
|
114
105
|
rescue Exception => e
|
106
|
+
LoaderSharedHelpers.record_and_print_exception(e)
|
115
107
|
LoaderSharedHelpers.about_to_abort(options, e)
|
116
|
-
|
117
|
-
puts "!> html: true" if e.respond_to?(:html?) && e.html?
|
118
|
-
puts "!> "
|
119
|
-
puts format_exception(e)
|
120
|
-
exit exit_code_for_exception(e)
|
108
|
+
exit LoaderSharedHelpers.exit_code_for_exception(e)
|
121
109
|
end
|
122
110
|
|
123
|
-
def self.
|
124
|
-
|
125
|
-
|
111
|
+
def self.create_server(options)
|
112
|
+
if defined?(NativeSupport)
|
113
|
+
unix_path_max = NativeSupport::UNIX_PATH_MAX
|
114
|
+
else
|
115
|
+
unix_path_max = options.fetch('UNIX_PATH_MAX', 100).to_i
|
116
|
+
end
|
117
|
+
if options['socket_dir']
|
118
|
+
socket_dir = options['socket_dir']
|
119
|
+
socket_prefix = "preloader"
|
120
|
+
else
|
121
|
+
socket_dir = Dir.tmpdir
|
122
|
+
socket_prefix = "PsgPreloader"
|
123
|
+
end
|
124
|
+
|
125
|
+
socket_filename = nil
|
126
|
+
server = nil
|
127
|
+
Utils.retry_at_most(128, Errno::EADDRINUSE) do
|
128
|
+
socket_filename = "#{socket_dir}/#{socket_prefix}.#{rand(0xFFFFFFFF).to_s(36)}"
|
129
|
+
socket_filename = socket_filename.slice(0, unix_path_max - 10)
|
130
|
+
server = UNIXServer.new(socket_filename)
|
131
|
+
end
|
132
|
+
server.close_on_exec!
|
133
|
+
File.chmod(0600, socket_filename)
|
126
134
|
|
135
|
+
[server, socket_filename]
|
136
|
+
end
|
137
|
+
|
138
|
+
def self.reinitialize_std_channels(work_dir)
|
139
|
+
if File.exist?("#{work_dir}/stdin")
|
140
|
+
STDIN.reopen("#{work_dir}/stdin", 'r')
|
141
|
+
end
|
142
|
+
if File.exist?("#{work_dir}/stdout_and_err")
|
143
|
+
STDOUT.reopen("#{work_dir}/stdout_and_err", 'w')
|
144
|
+
STDERR.reopen(STDOUT)
|
145
|
+
end
|
146
|
+
STDOUT.sync = STDERR.sync = true
|
147
|
+
end
|
148
|
+
|
149
|
+
def self.negotiate_spawn_command
|
127
150
|
begin
|
128
|
-
|
129
|
-
|
130
|
-
|
151
|
+
work_dir = ENV['PASSENGER_SPAWN_WORK_DIR']
|
152
|
+
@@options = File.open("#{work_dir}/args.json", 'rb') do |f|
|
153
|
+
Utils::JSON.parse(f.read)
|
154
|
+
end
|
155
|
+
|
156
|
+
reinitialize_std_channels(work_dir)
|
157
|
+
|
158
|
+
LoaderSharedHelpers.run_block_and_record_step_progress('SUBPROCESS_PREPARE_AFTER_FORKING_FROM_PRELOADER') do
|
159
|
+
LoaderSharedHelpers.before_handling_requests(true, options)
|
160
|
+
end
|
161
|
+
|
162
|
+
handler = nil
|
163
|
+
LoaderSharedHelpers.run_block_and_record_step_progress('SUBPROCESS_LISTEN') do
|
164
|
+
handler = RequestHandler.new(STDIN, options.merge("app" => app))
|
131
165
|
end
|
132
|
-
@@options = LoaderSharedHelpers.sanitize_spawn_options(@@options)
|
133
166
|
|
134
|
-
LoaderSharedHelpers.
|
135
|
-
|
167
|
+
LoaderSharedHelpers.dump_all_information(options)
|
168
|
+
LoaderSharedHelpers.advertise_sockets(options, handler)
|
169
|
+
LoaderSharedHelpers.advertise_readiness(options)
|
136
170
|
rescue Exception => e
|
171
|
+
LoaderSharedHelpers.record_and_print_exception(e)
|
137
172
|
LoaderSharedHelpers.about_to_abort(options, e)
|
138
|
-
|
139
|
-
puts "!> "
|
140
|
-
puts format_exception(e)
|
141
|
-
exit exit_code_for_exception(e)
|
173
|
+
exit LoaderSharedHelpers.exit_code_for_exception(e)
|
142
174
|
end
|
143
175
|
|
144
|
-
LoaderSharedHelpers.advertise_readiness
|
145
|
-
LoaderSharedHelpers.advertise_sockets(STDOUT, handler)
|
146
|
-
puts "!> "
|
147
176
|
handler
|
148
177
|
end
|
149
178
|
|
@@ -151,10 +180,34 @@ module PhusionPassenger
|
|
151
180
|
################## Main code ##################
|
152
181
|
|
153
182
|
|
154
|
-
handshake_and_read_startup_request
|
155
183
|
init_passenger
|
156
|
-
|
157
|
-
|
184
|
+
@@options = PreloaderSharedHelpers.init(self)
|
185
|
+
LoaderSharedHelpers.record_journey_step_end('SUBPROCESS_WRAPPER_PREPARATION',
|
186
|
+
'STEP_PERFORMED')
|
187
|
+
|
188
|
+
LoaderSharedHelpers.run_block_and_record_step_progress('SUBPROCESS_APP_LOAD_OR_EXEC') do
|
189
|
+
preload_app
|
190
|
+
end
|
191
|
+
|
192
|
+
server = nil
|
193
|
+
LoaderSharedHelpers.run_block_and_record_step_progress('SUBPROCESS_LISTEN') do
|
194
|
+
begin
|
195
|
+
server = create_server(options)
|
196
|
+
PreloaderSharedHelpers.advertise_sockets(options, server)
|
197
|
+
LoaderSharedHelpers.dump_all_information(options)
|
198
|
+
rescue Exception => e
|
199
|
+
LoaderSharedHelpers.record_and_print_exception(e)
|
200
|
+
LoaderSharedHelpers.about_to_abort(options, e)
|
201
|
+
exit LoaderSharedHelpers.exit_code_for_exception(e)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
LoaderSharedHelpers.advertise_readiness(options)
|
206
|
+
|
207
|
+
subprocess_work_dir = PreloaderSharedHelpers.run_main_loop(server, options)
|
208
|
+
if subprocess_work_dir
|
209
|
+
# Inside forked subprocess
|
210
|
+
ENV['PASSENGER_SPAWN_WORK_DIR'] = subprocess_work_dir
|
158
211
|
handler = negotiate_spawn_command
|
159
212
|
handler.main_loop
|
160
213
|
handler.cleanup
|