passenger 5.0.21 → 5.0.22
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 +8 -8
- checksums.yaml.gz.asc +7 -7
- data.tar.gz.asc +7 -7
- data/CHANGELOG +38 -2
- data/CONTRIBUTORS +3 -0
- data/README.md +5 -1
- data/bin/passenger-status +2 -7
- data/build/agent.rb +2 -0
- data/build/cxx_dependency_map.rb +1464 -162
- data/build/node_tests.rb +1 -1
- data/build/packaging.rb +1 -1
- data/dev/ci/run_travis.sh +1 -1
- data/dev/vagrant/provision.sh +1 -1
- data/npm-shrinkwrap.json +635 -125
- data/package.json +1 -1
- data/resources/templates/standalone/config.erb +33 -161
- data/resources/templates/standalone/global.erb +15 -0
- data/resources/templates/standalone/http.erb +40 -0
- data/resources/templates/standalone/mass_deployment_default_server.erb +11 -0
- data/resources/templates/standalone/rails_asset_pipeline.erb +22 -0
- data/resources/templates/standalone/server.erb +58 -0
- data/src/agent/Core/ApiServer.h +37 -32
- data/src/agent/Core/ApplicationPool/BasicGroupInfo.h +1 -1
- data/src/agent/Core/ApplicationPool/BasicProcessInfo.h +6 -0
- data/src/agent/Core/ApplicationPool/Common.h +1 -1
- data/src/agent/Core/ApplicationPool/Group/OutOfBandWork.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/ProcessListManagement.cpp +4 -0
- data/src/agent/Core/ApplicationPool/Implementation.cpp +2 -2
- data/src/agent/Core/ApplicationPool/Options.h +18 -1
- data/src/agent/Core/ApplicationPool/Pool.h +1 -1
- data/src/agent/Core/ApplicationPool/Pool/AnalyticsCollection.cpp +6 -6
- data/src/agent/Core/ApplicationPool/Pool/GeneralUtils.cpp +3 -3
- data/src/agent/Core/ApplicationPool/Pool/InitializationAndShutdown.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool/Miscellaneous.cpp +6 -0
- data/src/agent/Core/ApplicationPool/Process.h +6 -1
- data/src/agent/Core/ApplicationPool/Socket.h +9 -12
- data/src/agent/Core/Controller.h +422 -0
- data/src/agent/Core/{RequestHandler → Controller}/AppResponse.h +2 -0
- data/src/agent/Core/{RequestHandler → Controller}/BufferBody.cpp +27 -5
- data/src/agent/Core/{RequestHandler → Controller}/CheckoutSession.cpp +61 -31
- data/src/agent/Core/{RequestHandler → Controller}/Client.h +5 -2
- data/src/agent/Core/{RequestHandler → Controller}/ForwardResponse.cpp +93 -42
- data/src/agent/Core/{RequestHandler → Controller}/Hooks.cpp +107 -60
- data/src/agent/Core/Controller/Implementation.cpp +38 -0
- data/src/agent/Core/{RequestHandler → Controller}/InitRequest.cpp +134 -80
- data/src/agent/Core/Controller/InitializationAndShutdown.cpp +165 -0
- data/src/agent/Core/{RequestHandler/Utils.cpp → Controller/InternalUtils.cpp} +49 -32
- data/src/agent/Core/Controller/Miscellaneous.cpp +116 -0
- data/src/agent/Core/{RequestHandler → Controller}/Request.h +6 -4
- data/src/agent/Core/{RequestHandler → Controller}/SendRequest.cpp +205 -130
- data/src/agent/Core/Controller/StateInspectionAndConfiguration.cpp +161 -0
- data/src/agent/Core/{RequestHandler → Controller}/TurboCaching.h +3 -0
- data/src/agent/Core/CoreMain.cpp +62 -51
- data/src/agent/Core/OptionParser.h +24 -0
- data/src/agent/Core/ResponseCache.h +5 -5
- data/src/agent/Core/SpawningKit/Config.h +2 -2
- data/src/agent/Core/SpawningKit/SmartSpawner.h +1 -1
- data/src/agent/Core/UnionStation/{Core.h → Context.h} +14 -18
- data/src/agent/Core/UnionStation/StopwatchLog.h +3 -2
- data/src/agent/Core/UnionStation/Transaction.h +7 -7
- data/src/agent/Shared/ApiServerUtils.h +9 -1
- data/src/agent/UstRouter/ApiServer.h +5 -2
- data/src/agent/UstRouter/Controller.h +27 -9
- data/src/agent/UstRouter/UstRouterMain.cpp +1 -0
- data/src/agent/Watchdog/ApiServer.h +5 -2
- data/src/apache2_module/ConfigurationCommands.cpp +7 -0
- data/src/apache2_module/ConfigurationFields.hpp +2 -0
- data/src/apache2_module/ConfigurationSetters.cpp +24 -0
- data/src/apache2_module/CreateDirConfig.cpp +1 -0
- data/src/apache2_module/Hooks.cpp +6 -5
- data/src/apache2_module/MergeDirConfig.cpp +7 -0
- data/src/apache2_module/SetHeaders.cpp +5 -0
- data/src/cxx_supportlib/Constants.h +5 -3
- data/src/cxx_supportlib/SafeLibev.h +2 -1
- data/src/cxx_supportlib/UnionStationFilterSupport.h +2 -1
- data/src/cxx_supportlib/Utils/ReleaseableScopedPointer.h +70 -0
- data/src/cxx_supportlib/vendor-modified/boost/libs/regex/src/regex_raw_buffer.cpp +6 -6
- data/src/helper-scripts/node-loader.js +59 -0
- data/src/nginx_module/CacheLocationConfig.c +48 -0
- data/src/nginx_module/ConfigurationCommands.c +20 -0
- data/src/nginx_module/ConfigurationFields.h +4 -0
- data/src/nginx_module/CreateLocationConfig.c +8 -0
- data/src/nginx_module/MergeLocationConfig.c +12 -0
- data/src/nodejs_supportlib/phusion_passenger/log_express.js +106 -0
- data/src/nodejs_supportlib/phusion_passenger/log_mongodb.js +203 -0
- data/src/nodejs_supportlib/phusion_passenger/ustreporter.js +227 -0
- data/src/nodejs_supportlib/phusion_passenger/ustrouter_connector.js +446 -0
- data/src/nodejs_supportlib/vendor-copy/codify/codify.js +44 -0
- data/src/nodejs_supportlib/vendor-copy/codify/package.json +29 -0
- data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/context.js +200 -0
- data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/glue.js +488 -0
- data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/index.js +407 -0
- data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/node_modules/shimmer/index.js +90 -0
- data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/node_modules/shimmer/package.json +40 -0
- data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/package.json +54 -0
- data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/emitter-listener/listener.js +160 -0
- data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/emitter-listener/node_modules/shimmer/index.js +90 -0
- data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/emitter-listener/node_modules/shimmer/package.json +40 -0
- data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/emitter-listener/package.json +46 -0
- data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/package.json +56 -0
- data/src/nodejs_supportlib/vendor-copy/network-byte-order/lib/index.js +102 -0
- data/src/nodejs_supportlib/vendor-copy/network-byte-order/package.json +51 -0
- data/src/nodejs_supportlib/vendor-copy/winston/LICENSE +19 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston.js +165 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/common.js +483 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/config.js +62 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/config/cli-config.js +35 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/config/npm-config.js +27 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/config/syslog-config.js +31 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/container.js +127 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/exception.js +56 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/logger.js +701 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports.js +34 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/console.js +128 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/daily-rotate-file.js +601 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/file.js +675 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/http.js +232 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/memory.js +89 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/transport.js +135 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/webhook.js +146 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/async/LICENSE +19 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/async/lib/async.js +1283 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/async/package.json +66 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/async/support/sync-package-managers.js +53 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/MIT-LICENSE.txt +23 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/colors.js +176 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/custom/trap.js +45 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/custom/zalgo.js +104 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/extendStringPrototype.js +118 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/index.js +12 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/maps/america.js +12 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/maps/rainbow.js +13 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/maps/random.js +8 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/maps/zebra.js +5 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/styles.js +77 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/system/supports-colors.js +61 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/package.json +35 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/safe.js +9 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/themes/generic-logging.js +12 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/cycle/cycle.js +170 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/cycle/package.json +30 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/eyes/LICENSE +20 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/eyes/lib/eyes.js +236 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/eyes/package.json +42 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/isstream/LICENSE.md +11 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/isstream/isstream.js +27 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/isstream/package.json +42 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/pkginfo/LICENSE +19 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/pkginfo/lib/pkginfo.js +136 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/pkginfo/package.json +56 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/stack-trace/License +19 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/stack-trace/lib/stack-trace.js +111 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/stack-trace/package.json +33 -0
- data/src/nodejs_supportlib/vendor-copy/winston/package.json +87 -0
- data/src/ruby_supportlib/phusion_passenger.rb +3 -4
- data/src/ruby_supportlib/phusion_passenger/admin_tools/instance.rb +19 -2
- data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +8 -0
- data/src/ruby_supportlib/phusion_passenger/config/list_instances_command.rb +2 -6
- data/src/ruby_supportlib/phusion_passenger/config/reopen_logs_command.rb +13 -0
- data/src/ruby_supportlib/phusion_passenger/config/restart_app_command.rb +3 -0
- data/src/ruby_supportlib/phusion_passenger/config/utils.rb +9 -7
- data/src/ruby_supportlib/phusion_passenger/config/validate_install_command.rb +8 -1
- data/src/ruby_supportlib/phusion_passenger/constants.rb +3 -1
- data/src/ruby_supportlib/phusion_passenger/native_support.rb +20 -4
- data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +8 -0
- data/src/ruby_supportlib/phusion_passenger/packaging.rb +1 -0
- data/src/ruby_supportlib/phusion_passenger/platform_info/apache_detector.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/operating_system.rb +11 -4
- data/src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +647 -0
- data/src/ruby_supportlib/phusion_passenger/standalone/config_utils.rb +229 -15
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb +35 -323
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +36 -12
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command/nginx_engine.rb +123 -14
- data/src/ruby_supportlib/phusion_passenger/standalone/status_command.rb +32 -17
- data/src/ruby_supportlib/phusion_passenger/standalone/stop_command.rb +32 -21
- data/src/ruby_supportlib/phusion_passenger/standalone/version_command.rb +5 -5
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/README.md +2 -2
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/Rakefile +5 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core.rb +68 -24
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/api.rb +9 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/context.rb +9 -7
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter.rb +3 -2
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/basics.rb +8 -5
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/simple_json.rb +395 -0
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/transaction.rb +10 -7
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/utils.rb +14 -0
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/version_data.rb +2 -2
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml +4 -2
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.example +2 -2
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.travis +2 -2
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.travis-with-sudo +16 -0
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Gemfile +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Gemfile.lock +2 -2
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/README.md +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails.rb +44 -17
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/active_support_cache_subscriber.rb +16 -7
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/version_data.rb +2 -2
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/union_station_hooks_rails.gemspec +1 -1
- metadata +99 -16
- metadata.gz.asc +7 -7
- data/resources/oss-binaries.phusionpassenger.com.crt +0 -248
- data/src/agent/Core/RequestHandler.h +0 -471
@@ -132,11 +132,20 @@ coreUsage() {
|
|
132
132
|
printf(" Maximum time that preloader processes may be\n");
|
133
133
|
printf(" be idle. A value of 0 means that preloader\n");
|
134
134
|
printf(" processes never timeout. Default: %d\n", DEFAULT_MAX_PRELOADER_IDLE_TIME);
|
135
|
+
printf(" --force-max-concurrent-requests-per-process NUMBER\n");
|
136
|
+
printf(" Force " SHORT_PROGRAM_NAME " to believe that an application\n");
|
137
|
+
printf(" process can handle the given number of concurrent\n");
|
138
|
+
printf(" requests per process\n");
|
135
139
|
printf(" --min-instances N Minimum number of application processes. Default: 1\n");
|
140
|
+
printf(" --memory-limit MB Restart application processes that go over the\n");
|
141
|
+
printf(" given memory limit (Enterprise only)\n");
|
136
142
|
printf("\n");
|
137
143
|
printf("Request handling options (optional):\n");
|
138
144
|
printf(" --max-request-time Abort requests that take too much time (Enterprise\n");
|
139
145
|
printf(" only)\n");
|
146
|
+
printf(" --max-request-queue-size NUMBER\n");
|
147
|
+
printf(" Specify request queue size. Default: %d\n",
|
148
|
+
DEFAULT_MAX_REQUEST_QUEUE_SIZE);
|
140
149
|
printf(" --sticky-sessions Enable sticky sessions\n");
|
141
150
|
printf(" --sticky-sessions-cookie-name NAME\n");
|
142
151
|
printf(" Cookie name to use for sticky sessions.\n");
|
@@ -145,6 +154,9 @@ coreUsage() {
|
|
145
154
|
printf(" Vary the turbocache by the cookie of the given name\n");
|
146
155
|
printf(" --disable-turbocaching\n");
|
147
156
|
printf(" Disable turbocaching\n");
|
157
|
+
printf(" --no-abort-websockets-on-process-shutdown\n");
|
158
|
+
printf(" Do not abort WebSocket connections on process\n");
|
159
|
+
printf(" shutdown or restart\n");
|
148
160
|
printf("\n");
|
149
161
|
printf("Other options (optional):\n");
|
150
162
|
printf(" --log-file PATH Log to the given file.\n");
|
@@ -256,9 +268,15 @@ parseCoreOption(int argc, const char *argv[], int &i, VariantMap &options) {
|
|
256
268
|
} else if (p.isValueFlag(argc, i, argv[i], '\0', "--max-preloader-idle-time")) {
|
257
269
|
options.setInt("max_preloader_idle_time", atoi(argv[i + 1]));
|
258
270
|
i += 2;
|
271
|
+
} else if (p.isValueFlag(argc, i, argv[i], '\0', "--force-max-concurrent-requests-per-process")) {
|
272
|
+
options.setInt("force_max_concurrent_requests_per_process", atoi(argv[i + 1]));
|
273
|
+
i += 2;
|
259
274
|
} else if (p.isValueFlag(argc, i, argv[i], '\0', "--min-instances")) {
|
260
275
|
options.setInt("min_instances", atoi(argv[i + 1]));
|
261
276
|
i += 2;
|
277
|
+
} else if (p.isValueFlag(argc, i, argv[i], '\0', "--memory-limit")) {
|
278
|
+
options.setInt("memory_limit", atoi(argv[i + 1]));
|
279
|
+
i += 2;
|
262
280
|
} else if (p.isValueFlag(argc, i, argv[i], 'e', "--environment")) {
|
263
281
|
options.set("environment", argv[i + 1]);
|
264
282
|
i += 2;
|
@@ -292,6 +310,9 @@ parseCoreOption(int argc, const char *argv[], int &i, VariantMap &options) {
|
|
292
310
|
} else if (p.isValueFlag(argc, i, argv[i], '\0', "--max-request-time")) {
|
293
311
|
options.setInt("max_request_time", atoi(argv[i + 1]));
|
294
312
|
i += 2;
|
313
|
+
} else if (p.isValueFlag(argc, i, argv[i], '\0', "--max-request-queue-size")) {
|
314
|
+
options.setInt("max_request_queue_size", atoi(argv[i + 1]));
|
315
|
+
i += 2;
|
295
316
|
} else if (p.isFlag(argv[i], '\0', "--sticky-sessions")) {
|
296
317
|
options.setBool("sticky_sessions", true);
|
297
318
|
i++;
|
@@ -304,6 +325,9 @@ parseCoreOption(int argc, const char *argv[], int &i, VariantMap &options) {
|
|
304
325
|
} else if (p.isFlag(argv[i], '\0', "--disable-turbocaching")) {
|
305
326
|
options.setBool("turbocaching", false);
|
306
327
|
i++;
|
328
|
+
} else if (p.isFlag(argv[i], '\0', "--no-abort-websockets-on-process-shutdown")) {
|
329
|
+
options.setBool("abort_websockets_on_process_shutdown", false);
|
330
|
+
i++;
|
307
331
|
} else if (p.isValueFlag(argc, i, argv[i], '\0', "--ruby")) {
|
308
332
|
options.set("default_ruby", argv[i + 1]);
|
309
333
|
i += 2;
|
@@ -485,19 +485,19 @@ public:
|
|
485
485
|
*
|
486
486
|
* @post result == !req->cacheKey.empty()
|
487
487
|
*/
|
488
|
-
template<typename
|
489
|
-
bool prepareRequest(
|
488
|
+
template<typename Controller>
|
489
|
+
bool prepareRequest(Controller *controller, Request *req) {
|
490
490
|
if (req->upgraded() || req->host == NULL) {
|
491
491
|
return false;
|
492
492
|
}
|
493
493
|
|
494
494
|
LString *varyCookieName = req->secureHeaders.lookup(PASSENGER_VARY_TURBOCACHE_BY_COOKIE);
|
495
|
-
if (varyCookieName == NULL && !
|
495
|
+
if (varyCookieName == NULL && !controller->defaultVaryTurbocacheByCookie.empty()) {
|
496
496
|
varyCookieName = (LString *) psg_palloc(req->pool, sizeof(LString));
|
497
497
|
psg_lstr_init(varyCookieName);
|
498
498
|
psg_lstr_append(varyCookieName, req->pool,
|
499
|
-
|
500
|
-
|
499
|
+
controller->defaultVaryTurbocacheByCookie.data(),
|
500
|
+
controller->defaultVaryTurbocacheByCookie.size());
|
501
501
|
}
|
502
502
|
if (varyCookieName != NULL) {
|
503
503
|
LString *cookieHeader = req->headers.lookup(COOKIE);
|
@@ -35,7 +35,7 @@
|
|
35
35
|
#include <RandomGenerator.h>
|
36
36
|
#include <Exceptions.h>
|
37
37
|
#include <Utils/VariantMap.h>
|
38
|
-
#include <Core/UnionStation/
|
38
|
+
#include <Core/UnionStation/Context.h>
|
39
39
|
|
40
40
|
namespace Passenger {
|
41
41
|
namespace ApplicationPool2 {
|
@@ -63,7 +63,7 @@ struct Config {
|
|
63
63
|
ErrorHandler errorHandler;
|
64
64
|
|
65
65
|
// Used for Union Station logging.
|
66
|
-
UnionStation::
|
66
|
+
UnionStation::ContextPtr unionStationContext;
|
67
67
|
|
68
68
|
// Used by SmartSpawner and DirectSpawner.
|
69
69
|
RandomGeneratorPtr randomGenerator;
|
@@ -520,7 +520,7 @@ private:
|
|
520
520
|
|
521
521
|
try {
|
522
522
|
string message = details.io.readAll(&details.timeout);
|
523
|
-
SpawnException e("An error
|
523
|
+
SpawnException e("An error occurred while starting up the preloader.",
|
524
524
|
message,
|
525
525
|
attributes["html"] == "true",
|
526
526
|
SpawnException::PRELOADER_STARTUP_EXPLAINABLE_ERROR);
|
@@ -23,8 +23,8 @@
|
|
23
23
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
24
|
* THE SOFTWARE.
|
25
25
|
*/
|
26
|
-
#ifndef
|
27
|
-
#define
|
26
|
+
#ifndef _PASSENGER_UNION_STATION_CONTEXT_H_
|
27
|
+
#define _PASSENGER_UNION_STATION_CONTEXT_H_
|
28
28
|
|
29
29
|
#include <boost/shared_ptr.hpp>
|
30
30
|
#include <boost/enable_shared_from_this.hpp>
|
@@ -53,7 +53,7 @@ using namespace std;
|
|
53
53
|
using namespace boost;
|
54
54
|
|
55
55
|
|
56
|
-
class
|
56
|
+
class Context: public boost::enable_shared_from_this<Context> {
|
57
57
|
private:
|
58
58
|
static const unsigned int CONNECTION_POOL_MAX_SIZE = 10;
|
59
59
|
|
@@ -80,14 +80,6 @@ private:
|
|
80
80
|
*/
|
81
81
|
unsigned long long nextReconnectTime;
|
82
82
|
|
83
|
-
static string determineNodeName(const string &givenNodeName) {
|
84
|
-
if (givenNodeName.empty()) {
|
85
|
-
return getHostName();
|
86
|
-
} else {
|
87
|
-
return givenNodeName;
|
88
|
-
}
|
89
|
-
}
|
90
|
-
|
91
83
|
static bool isNetworkError(int code) {
|
92
84
|
return code == EPIPE || code == ECONNREFUSED || code == ECONNRESET
|
93
85
|
|| code == EHOSTUNREACH || code == ENETDOWN || code == ENETUNREACH
|
@@ -154,7 +146,11 @@ private:
|
|
154
146
|
|
155
147
|
// Initialize session.
|
156
148
|
UPDATE_TRACE_POINT();
|
157
|
-
|
149
|
+
if (nodeName.empty()) {
|
150
|
+
writeArrayMessage(fd, &timeout, "init", NULL);
|
151
|
+
} else {
|
152
|
+
writeArrayMessage(fd, &timeout, "init", nodeName.c_str(), NULL);
|
153
|
+
}
|
158
154
|
if (!readArrayMessage(fd, args, &timeout)) {
|
159
155
|
throw SystemException("Cannot connect to the UstRouter", ECONNREFUSED);
|
160
156
|
} else if (args.size() < 2 || args[0] != "status") {
|
@@ -177,16 +173,16 @@ private:
|
|
177
173
|
}
|
178
174
|
|
179
175
|
public:
|
180
|
-
|
176
|
+
Context() {
|
181
177
|
initialize();
|
182
178
|
}
|
183
179
|
|
184
|
-
|
180
|
+
Context(const string &_serverAddress, const string &_username,
|
185
181
|
const string &_password, const string &_nodeName = string())
|
186
182
|
: serverAddress(_serverAddress),
|
187
183
|
username(_username),
|
188
184
|
password(_password),
|
189
|
-
nodeName(
|
185
|
+
nodeName(_nodeName)
|
190
186
|
{
|
191
187
|
initialize();
|
192
188
|
}
|
@@ -529,12 +525,12 @@ public:
|
|
529
525
|
|
530
526
|
|
531
527
|
inline void
|
532
|
-
_checkinConnection(const
|
533
|
-
|
528
|
+
_checkinConnection(const ContextPtr &ctx, const ConnectionPtr &connection) {
|
529
|
+
ctx->checkinConnection(connection);
|
534
530
|
}
|
535
531
|
|
536
532
|
|
537
533
|
} // namespace UnionStation
|
538
534
|
} // namespace Passenger
|
539
535
|
|
540
|
-
#endif /*
|
536
|
+
#endif /* _PASSENGER_UNION_STATION_CONTEXT_H_ */
|
@@ -32,6 +32,7 @@
|
|
32
32
|
|
33
33
|
#include <string>
|
34
34
|
|
35
|
+
#include <uv.h>
|
35
36
|
#include <StaticString.h>
|
36
37
|
#include <Exceptions.h>
|
37
38
|
#include <Utils/StrIntUtils.h>
|
@@ -92,7 +93,7 @@ public:
|
|
92
93
|
pos = appendData(pos, end, "BEGIN: ");
|
93
94
|
pos = appendData(pos, end, name);
|
94
95
|
pos = appendData(pos, end, " (");
|
95
|
-
pos = appendData(pos, end, usecToString(
|
96
|
+
pos = appendData(pos, end, usecToString(uv_hrtime() / 1000));
|
96
97
|
pos = appendData(pos, end, ",");
|
97
98
|
if (getrusage(RUSAGE_SELF, &usage) == -1) {
|
98
99
|
int e = errno;
|
@@ -140,7 +141,7 @@ public:
|
|
140
141
|
}
|
141
142
|
pos = appendData(pos, end, data.name);
|
142
143
|
pos = appendData(pos, end, " (");
|
143
|
-
pos = appendData(pos, end, usecToString(
|
144
|
+
pos = appendData(pos, end, usecToString(uv_hrtime() / 1000));
|
144
145
|
pos = appendData(pos, end, ",");
|
145
146
|
if (getrusage(RUSAGE_SELF, &usage) == -1) {
|
146
147
|
int e = errno;
|
@@ -58,10 +58,10 @@ enum ExceptionHandlingMode {
|
|
58
58
|
};
|
59
59
|
|
60
60
|
|
61
|
-
class
|
62
|
-
typedef boost::shared_ptr<
|
61
|
+
class Context;
|
62
|
+
typedef boost::shared_ptr<Context> ContextPtr;
|
63
63
|
|
64
|
-
inline void _checkinConnection(const
|
64
|
+
inline void _checkinConnection(const ContextPtr &ctx, const ConnectionPtr &connection);
|
65
65
|
|
66
66
|
|
67
67
|
class Transaction: public boost::noncopyable {
|
@@ -69,7 +69,7 @@ private:
|
|
69
69
|
static const int INT64_STR_BUFSIZE = 22; // Long enough for a 64-bit number.
|
70
70
|
static const unsigned long long IO_TIMEOUT = 5000000; // In microseconds.
|
71
71
|
|
72
|
-
const
|
72
|
+
const ContextPtr context;
|
73
73
|
const ConnectionPtr connection;
|
74
74
|
const string txnId;
|
75
75
|
const string groupName;
|
@@ -131,14 +131,14 @@ public:
|
|
131
131
|
: exceptionHandlingMode(PRINT)
|
132
132
|
{ }
|
133
133
|
|
134
|
-
Transaction(const
|
134
|
+
Transaction(const ContextPtr &_context,
|
135
135
|
const ConnectionPtr &_connection,
|
136
136
|
const string &_txnId,
|
137
137
|
const string &_groupName,
|
138
138
|
const string &_category,
|
139
139
|
const string &_unionStationKey,
|
140
140
|
ExceptionHandlingMode _exceptionHandlingMode = PRINT)
|
141
|
-
:
|
141
|
+
: context(_context),
|
142
142
|
connection(_connection),
|
143
143
|
txnId(_txnId),
|
144
144
|
groupName(_groupName),
|
@@ -180,7 +180,7 @@ public:
|
|
180
180
|
readArrayMessage(connection->fd, &timeout);
|
181
181
|
}
|
182
182
|
|
183
|
-
_checkinConnection(
|
183
|
+
_checkinConnection(context, connection);
|
184
184
|
guard.clear();
|
185
185
|
} catch (const SystemException &e) {
|
186
186
|
UPDATE_TRACE_POINT();
|
@@ -689,13 +689,17 @@ apiServerProcessPing(Server *server, Client *client, Request *req) {
|
|
689
689
|
|
690
690
|
template<typename Server, typename Client, typename Request>
|
691
691
|
inline void
|
692
|
-
|
692
|
+
apiServerProcessInfo(Server *server, Client *client, Request *req,
|
693
|
+
const boost::function<void (Json::Value &response)> &postprocessResponse =
|
694
|
+
boost::function<void (Json::Value &)>())
|
695
|
+
{
|
693
696
|
Authorization auth(authorize(server, client, req));
|
694
697
|
if (auth.canReadPool || auth.canInspectState) {
|
695
698
|
ServerKit::HeaderTable headers;
|
696
699
|
headers.insert(req->pool, "Content-Type", "application/json");
|
697
700
|
|
698
701
|
Json::Value response;
|
702
|
+
response["pid"] = (Json::UInt64) getpid();
|
699
703
|
response["program_name"] = PROGRAM_NAME;
|
700
704
|
response["program_version"] = PASSENGER_VERSION;
|
701
705
|
response["api_version"] = PASSENGER_API_VERSION;
|
@@ -705,6 +709,10 @@ apiServerProcessVersion(Server *server, Client *client, Request *req) {
|
|
705
709
|
response["passenger_enterprise"] = true;
|
706
710
|
#endif
|
707
711
|
|
712
|
+
if (postprocessResponse) {
|
713
|
+
postprocessResponse(response);
|
714
|
+
}
|
715
|
+
|
708
716
|
server->writeSimpleResponse(client, 200, &headers,
|
709
717
|
response.toStyledString());
|
710
718
|
if (!req->ended()) {
|
@@ -64,8 +64,11 @@ private:
|
|
64
64
|
void route(Client *client, Request *req, const StaticString &path) {
|
65
65
|
if (path == P_STATIC_STRING("/ping.json")) {
|
66
66
|
apiServerProcessPing(this, client, req);
|
67
|
-
} else if (path == P_STATIC_STRING("/
|
68
|
-
|
67
|
+
} else if (path == P_STATIC_STRING("/info.json")
|
68
|
+
// The "/version.json" path is deprecated
|
69
|
+
|| path == P_STATIC_STRING("/version.json"))
|
70
|
+
{
|
71
|
+
apiServerProcessInfo(this, client, req);
|
69
72
|
} else if (path == P_STATIC_STRING("/shutdown.json")) {
|
70
73
|
apiServerProcessShutdown(this, client, req);
|
71
74
|
} else if (path == P_STATIC_STRING("/backtraces.txt")) {
|
@@ -82,6 +82,7 @@ private:
|
|
82
82
|
string username;
|
83
83
|
string password;
|
84
84
|
string dumpDir;
|
85
|
+
string defaultNodeName;
|
85
86
|
bool devMode;
|
86
87
|
|
87
88
|
RandomGenerator randomGenerator;
|
@@ -488,8 +489,9 @@ private:
|
|
488
489
|
"already opened with a different node name (" <<
|
489
490
|
transaction->getNodeName() << " vs " << nodeName << ")");
|
490
491
|
if (ack) {
|
491
|
-
sendErrorToClient(client,
|
492
|
-
|
492
|
+
sendErrorToClient(client, "Cannot open transaction: transaction "
|
493
|
+
"already opened with a different node name (" +
|
494
|
+
transaction->getNodeName() + " vs " + nodeName + ")");
|
493
495
|
if (client->connected()) {
|
494
496
|
disconnect(&client);
|
495
497
|
}
|
@@ -497,10 +499,12 @@ private:
|
|
497
499
|
goto done;
|
498
500
|
}
|
499
501
|
if (OXT_UNLIKELY(transaction->getCategory() != category)) {
|
500
|
-
SKC_ERROR(client, "Cannot open transaction: transaction already opened with a different category name"
|
502
|
+
SKC_ERROR(client, "Cannot open transaction: transaction already opened with a different category name (" <<
|
503
|
+
transaction->getCategory() << " vs " << category << ")");
|
501
504
|
if (ack) {
|
502
505
|
sendErrorToClient(client,
|
503
|
-
|
506
|
+
"Cannot open transaction: transaction already opened with a different category name (" +
|
507
|
+
transaction->getCategory() + " vs " + category + ")");
|
504
508
|
if (client->connected()) {
|
505
509
|
disconnect(&client);
|
506
510
|
}
|
@@ -597,6 +601,8 @@ private:
|
|
597
601
|
}
|
598
602
|
|
599
603
|
void processInitMessage(Client *client, const vector<StaticString> &args) {
|
604
|
+
StaticString nodeName;
|
605
|
+
|
600
606
|
if (OXT_UNLIKELY(client->type != Client::UNINITIALIZED)) {
|
601
607
|
logErrorAndSendToClient(client, "Already initialized");
|
602
608
|
if (client->connected()) {
|
@@ -604,11 +610,16 @@ private:
|
|
604
610
|
}
|
605
611
|
goto done;
|
606
612
|
}
|
607
|
-
if (OXT_UNLIKELY(!
|
613
|
+
if (OXT_UNLIKELY(!expectingMinArgumentsCount(client, args, 1))) {
|
608
614
|
goto done;
|
609
615
|
}
|
610
616
|
|
611
|
-
|
617
|
+
nodeName = getStaticString(args, 1);
|
618
|
+
if (nodeName.empty()) {
|
619
|
+
client->nodeName = defaultNodeName;
|
620
|
+
} else {
|
621
|
+
client->nodeName.assign(nodeName.data(), nodeName.size());
|
622
|
+
}
|
612
623
|
client->type = Client::LOGGER;
|
613
624
|
sendOkToClient(client);
|
614
625
|
|
@@ -826,7 +837,7 @@ private:
|
|
826
837
|
}
|
827
838
|
|
828
839
|
static StaticString getStaticString(const vector<StaticString> &args,
|
829
|
-
unsigned int index, const StaticString &defaultValue =
|
840
|
+
unsigned int index, const StaticString &defaultValue = StaticString())
|
830
841
|
{
|
831
842
|
if (index < args.size()) {
|
832
843
|
return args[index];
|
@@ -894,7 +905,8 @@ private:
|
|
894
905
|
return category == P_STATIC_STRING("requests")
|
895
906
|
|| category == P_STATIC_STRING("processes")
|
896
907
|
|| category == P_STATIC_STRING("exceptions")
|
897
|
-
|| category == P_STATIC_STRING("system_metrics")
|
908
|
+
|| category == P_STATIC_STRING("system_metrics")
|
909
|
+
|| category == P_STATIC_STRING("internal_information");
|
898
910
|
}
|
899
911
|
|
900
912
|
LogSinkPtr openLogFile(Client *client, const StaticString &category) {
|
@@ -1115,15 +1127,20 @@ public:
|
|
1115
1127
|
username(options.get("ust_router_username", false, "")),
|
1116
1128
|
password(options.get("ust_router_password", false, "")),
|
1117
1129
|
dumpDir(options.get("ust_router_dump_dir", false, "/tmp")),
|
1130
|
+
defaultNodeName(options.get("ust_router_default_node_name", false, "")),
|
1118
1131
|
devMode(options.getBool("ust_router_dev_mode", false, false)),
|
1119
1132
|
remoteSender(
|
1120
1133
|
options.get("union_station_gateway_address", false, DEFAULT_UNION_STATION_GATEWAY_ADDRESS),
|
1121
1134
|
options.getInt("union_station_gateway_port", false, DEFAULT_UNION_STATION_GATEWAY_PORT),
|
1122
1135
|
options.get("union_station_gateway_cert", false, ""),
|
1123
|
-
options.get("union_station_proxy_address", false)),
|
1136
|
+
options.get("union_station_proxy_address", false, "")),
|
1124
1137
|
gcTimer(getLoop()),
|
1125
1138
|
flushTimer(getLoop())
|
1126
1139
|
{
|
1140
|
+
if (defaultNodeName.empty()) {
|
1141
|
+
defaultNodeName = getHostName();
|
1142
|
+
}
|
1143
|
+
|
1127
1144
|
gcTimer.set<Controller, &Controller::garbageCollect>(this);
|
1128
1145
|
gcTimer.start(GARBAGE_COLLECTION_TIMEOUT, GARBAGE_COLLECTION_TIMEOUT);
|
1129
1146
|
|
@@ -1156,6 +1173,7 @@ public:
|
|
1156
1173
|
} else {
|
1157
1174
|
doc["remote_sender"] = remoteSender.inspectStateAsJson();
|
1158
1175
|
}
|
1176
|
+
doc["default_node_name"] = defaultNodeName;
|
1159
1177
|
return doc;
|
1160
1178
|
}
|
1161
1179
|
|
@@ -67,8 +67,11 @@ private:
|
|
67
67
|
processStatusTxt(client, req);
|
68
68
|
} else if (path == P_STATIC_STRING("/ping.json")) {
|
69
69
|
apiServerProcessPing(this, client, req);
|
70
|
-
} else if (path == P_STATIC_STRING("/
|
71
|
-
|
70
|
+
} else if (path == P_STATIC_STRING("/info.json")
|
71
|
+
// The "/version.json" path is deprecated
|
72
|
+
|| path == P_STATIC_STRING("/version.json"))
|
73
|
+
{
|
74
|
+
apiServerProcessInfo(this, client, req);
|
72
75
|
} else if (path == P_STATIC_STRING("/shutdown.json")) {
|
73
76
|
apiServerProcessShutdown(this, client, req);
|
74
77
|
} else if (path == P_STATIC_STRING("/backtraces.txt")) {
|