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
@@ -230,6 +230,13 @@
|
|
230
230
|
"Application process group name."),
|
231
231
|
|
232
232
|
|
233
|
+
AP_INIT_TAKE1("PassengerForceMaxConcurrentRequestsPerProcess",
|
234
|
+
(Take1Func) cmd_passenger_force_max_concurrent_requests_per_process,
|
235
|
+
NULL,
|
236
|
+
OR_OPTIONS | ACCESS_CONF | RSRC_CONF,
|
237
|
+
"Force Passenger to believe that an application process can handle the given number of concurrent requests per process"),
|
238
|
+
|
239
|
+
|
233
240
|
AP_INIT_TAKE1("RailsEnv",
|
234
241
|
(Take1Func) cmd_passenger_app_env,
|
235
242
|
NULL,
|
@@ -59,6 +59,8 @@ struct GeneratedDirConfigPart {
|
|
59
59
|
Threeway stickySessions;
|
60
60
|
/** The cookie name to use for sticky sessions. */
|
61
61
|
Threeway stickySessionsCookieName;
|
62
|
+
/** Force Passenger to believe that an application process can handle the given number of concurrent requests per process */
|
63
|
+
int forceMaxConcurrentRequestsPerProcess;
|
62
64
|
/** The maximum number of simultaneously alive application instances a single application may occupy. */
|
63
65
|
int maxInstancesPerApp;
|
64
66
|
/** The maximum number of seconds that a preloader process may be idle before it is shutdown. */
|
@@ -420,4 +420,28 @@
|
|
420
420
|
return NULL;
|
421
421
|
}
|
422
422
|
|
423
|
+
|
424
|
+
static const char *
|
425
|
+
cmd_passenger_force_max_concurrent_requests_per_process(cmd_parms *cmd, void *pcfg, const char *arg) {
|
426
|
+
DirConfig *config = (DirConfig *) pcfg;
|
427
|
+
char *end;
|
428
|
+
long result;
|
429
|
+
|
430
|
+
result = strtol(arg, &end, 10);
|
431
|
+
if (*end != '\0') {
|
432
|
+
string message = "Invalid number specified for ";
|
433
|
+
message.append(cmd->directive->directive);
|
434
|
+
message.append(".");
|
435
|
+
|
436
|
+
char *messageStr = (char *) apr_palloc(cmd->temp_pool,
|
437
|
+
message.size() + 1);
|
438
|
+
memcpy(messageStr, message.c_str(), message.size() + 1);
|
439
|
+
return messageStr;
|
440
|
+
|
441
|
+
} else {
|
442
|
+
config->forceMaxConcurrentRequestsPerProcess = (int) result;
|
443
|
+
return NULL;
|
444
|
+
}
|
445
|
+
}
|
446
|
+
|
423
447
|
|
@@ -60,6 +60,7 @@
|
|
60
60
|
#include <Utils/StrIntUtils.h>
|
61
61
|
#include <Utils/Timer.h>
|
62
62
|
#include <Utils/HttpConstants.h>
|
63
|
+
#include <Utils/ReleaseableScopedPointer.h>
|
63
64
|
#include <Logging.h>
|
64
65
|
#include <WatchdogLauncher.h>
|
65
66
|
#include <Constants.h>
|
@@ -408,8 +409,8 @@ private:
|
|
408
409
|
return false;
|
409
410
|
}
|
410
411
|
} catch (const DocumentRootDeterminationError &e) {
|
411
|
-
|
412
|
-
note->errorReport = new ReportDocumentRootDeterminationError(e);
|
412
|
+
ReleaseableScopedPointer<RequestNote> note(new RequestNote(mapper, config));
|
413
|
+
note.get()->errorReport = new ReportDocumentRootDeterminationError(e);
|
413
414
|
apr_pool_userdata_set(note.release(), "Phusion Passenger",
|
414
415
|
RequestNote::cleanup, r->pool);
|
415
416
|
return true;
|
@@ -428,8 +429,8 @@ private:
|
|
428
429
|
* Phusion Passenger for the rest of the request.
|
429
430
|
*/
|
430
431
|
if (e.code() == EACCES || e.code() == EPERM) {
|
431
|
-
|
432
|
-
note->errorReport = new ReportFileSystemError(e);
|
432
|
+
ReleaseableScopedPointer<RequestNote> note(new RequestNote(mapper, config));
|
433
|
+
note.get()->errorReport = new ReportFileSystemError(e);
|
433
434
|
apr_pool_userdata_set(note.release(), "Phusion Passenger",
|
434
435
|
RequestNote::cleanup, r->pool);
|
435
436
|
return true;
|
@@ -1513,7 +1514,7 @@ public:
|
|
1513
1514
|
RequestNote *note = getRequestNote(r);
|
1514
1515
|
if (note != 0 && hasModAutoIndex()) {
|
1515
1516
|
note->handlerBeforeModAutoIndex = r->handler;
|
1516
|
-
r->handler = "";
|
1517
|
+
r->handler = "passenger-skip-autoindex";
|
1517
1518
|
}
|
1518
1519
|
return DECLINED;
|
1519
1520
|
}
|
@@ -229,3 +229,10 @@
|
|
229
229
|
add->appGroupName;
|
230
230
|
|
231
231
|
|
232
|
+
|
233
|
+
config->forceMaxConcurrentRequestsPerProcess =
|
234
|
+
(add->forceMaxConcurrentRequestsPerProcess == UNSET_INT_VALUE) ?
|
235
|
+
base->forceMaxConcurrentRequestsPerProcess :
|
236
|
+
add->forceMaxConcurrentRequestsPerProcess;
|
237
|
+
|
238
|
+
|
@@ -150,3 +150,8 @@
|
|
150
150
|
sizeof("!~PASSENGER_APP_GROUP_NAME") - 1), config->appGroupName);
|
151
151
|
|
152
152
|
|
153
|
+
|
154
|
+
addHeader(r, result, StaticString("!~PASSENGER_FORCE_MAX_CONCURRENT_REQUESTS_PER_PROCESS",
|
155
|
+
sizeof("!~PASSENGER_FORCE_MAX_CONCURRENT_REQUESTS_PER_PROCESS") - 1), config->forceMaxConcurrentRequestsPerProcess);
|
156
|
+
|
157
|
+
|
@@ -69,6 +69,8 @@
|
|
69
69
|
|
70
70
|
#define DEFAULT_MAX_PRELOADER_IDLE_TIME 300
|
71
71
|
|
72
|
+
#define DEFAULT_MAX_REQUEST_QUEUE_SIZE 100
|
73
|
+
|
72
74
|
#define DEFAULT_MBUF_CHUNK_SIZE 512
|
73
75
|
|
74
76
|
#define DEFAULT_NODEJS "node"
|
@@ -109,15 +111,15 @@
|
|
109
111
|
|
110
112
|
#define MESSAGE_SERVER_MAX_USERNAME_SIZE 100
|
111
113
|
|
112
|
-
#define PASSENGER_API_VERSION "0.
|
114
|
+
#define PASSENGER_API_VERSION "0.3"
|
113
115
|
|
114
116
|
#define PASSENGER_API_VERSION_MAJOR 0
|
115
117
|
|
116
|
-
#define PASSENGER_API_VERSION_MINOR
|
118
|
+
#define PASSENGER_API_VERSION_MINOR 3
|
117
119
|
|
118
120
|
#define PASSENGER_DEFAULT_USER "nobody"
|
119
121
|
|
120
|
-
#define PASSENGER_VERSION "5.0.
|
122
|
+
#define PASSENGER_VERSION "5.0.22"
|
121
123
|
|
122
124
|
#define POOL_HELPER_THREAD_STACK_SIZE 262144
|
123
125
|
|
@@ -31,6 +31,7 @@
|
|
31
31
|
#include <list>
|
32
32
|
#include <memory>
|
33
33
|
#include <boost/thread.hpp>
|
34
|
+
#include <boost/scoped_ptr.hpp>
|
34
35
|
#include <boost/shared_ptr.hpp>
|
35
36
|
#include <boost/function.hpp>
|
36
37
|
#include <boost/bind.hpp>
|
@@ -81,7 +82,7 @@ private:
|
|
81
82
|
}
|
82
83
|
|
83
84
|
static void timeoutHandler(int revents, void *arg) {
|
84
|
-
|
85
|
+
boost::scoped_ptr<Callback> callback((Callback *) arg);
|
85
86
|
(*callback)();
|
86
87
|
}
|
87
88
|
|
@@ -47,6 +47,7 @@
|
|
47
47
|
#include <StaticString.h>
|
48
48
|
#include <Exceptions.h>
|
49
49
|
#include <Utils/StrIntUtils.h>
|
50
|
+
#include <Utils/ReleaseableScopedPointer.h>
|
50
51
|
|
51
52
|
namespace Passenger {
|
52
53
|
namespace FilterSupport {
|
@@ -783,7 +784,7 @@ private:
|
|
783
784
|
|
784
785
|
SimpleContext *parse() const {
|
785
786
|
if (parsedData == NULL) {
|
786
|
-
|
787
|
+
ReleaseableScopedPointer<SimpleContext> ctx(new SimpleContext());
|
787
788
|
reallyParse(logData, *ctx.get());
|
788
789
|
parsedData = ctx.release();
|
789
790
|
}
|
@@ -0,0 +1,70 @@
|
|
1
|
+
/*
|
2
|
+
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
+
* Copyright (c) 2015 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_RELEASEABLE_SCOPED_POINTER_H_
|
27
|
+
#define _PASSENGER_RELEASEABLE_SCOPED_POINTER_H_
|
28
|
+
|
29
|
+
#include <boost/noncopyable.hpp>
|
30
|
+
#include <cstddef>
|
31
|
+
|
32
|
+
namespace Passenger {
|
33
|
+
|
34
|
+
|
35
|
+
using namespace std;
|
36
|
+
|
37
|
+
/**
|
38
|
+
* This is like std::auto_ptr, but does not raise deprecation warnings on newer
|
39
|
+
* compilers. We cannot replace std::auto_ptr with boost::scoped_ptr or
|
40
|
+
* boost::shared_ptr because have a few use cases for std::auto_ptr.release().
|
41
|
+
*/
|
42
|
+
template<typename T>
|
43
|
+
class ReleaseableScopedPointer: public boost::noncopyable {
|
44
|
+
private:
|
45
|
+
T *p;
|
46
|
+
|
47
|
+
public:
|
48
|
+
ReleaseableScopedPointer(T *_p)
|
49
|
+
: p(_p)
|
50
|
+
{ }
|
51
|
+
|
52
|
+
~ReleaseableScopedPointer() {
|
53
|
+
delete p;
|
54
|
+
}
|
55
|
+
|
56
|
+
T *get() const {
|
57
|
+
return p;
|
58
|
+
}
|
59
|
+
|
60
|
+
T *release() {
|
61
|
+
T *tmp = p;
|
62
|
+
p = NULL;
|
63
|
+
return tmp;
|
64
|
+
}
|
65
|
+
};
|
66
|
+
|
67
|
+
|
68
|
+
} // namespace Passenger
|
69
|
+
|
70
|
+
#endif /* _PASSENGER_RELEASEABLE_SCOPED_POINTER_H_ */
|
@@ -3,8 +3,8 @@
|
|
3
3
|
* Copyright (c) 2004
|
4
4
|
* John Maddock
|
5
5
|
*
|
6
|
-
* Use, modification and distribution are subject to the
|
7
|
-
* Boost Software License, Version 1.0. (See accompanying file
|
6
|
+
* Use, modification and distribution are subject to the
|
7
|
+
* Boost Software License, Version 1.0. (See accompanying file
|
8
8
|
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
9
9
|
*
|
10
10
|
*/
|
@@ -36,15 +36,15 @@ namespace boost{ namespace re_detail{
|
|
36
36
|
|
37
37
|
void BOOST_REGEX_CALL raw_storage::resize(size_type n)
|
38
38
|
{
|
39
|
-
|
39
|
+
size_type newsize = start ? last - start : 1024;
|
40
40
|
while(newsize < n)
|
41
41
|
newsize *= 2;
|
42
|
-
|
42
|
+
size_type datasize = end - start;
|
43
43
|
// extend newsize to WORD/DWORD boundary:
|
44
44
|
newsize = (newsize + padding_mask) & ~(padding_mask);
|
45
45
|
|
46
46
|
// allocate and copy data:
|
47
|
-
|
47
|
+
pointer ptr = static_cast<pointer>(::operator new(newsize));
|
48
48
|
BOOST_REGEX_NOEH_ASSERT(ptr)
|
49
49
|
if(start)
|
50
50
|
std::memcpy(ptr, start, datasize);
|
@@ -63,7 +63,7 @@ void* BOOST_REGEX_CALL raw_storage::insert(size_type pos, size_type n)
|
|
63
63
|
BOOST_ASSERT(pos <= size_type(end - start));
|
64
64
|
if(size_type(last - end) < n)
|
65
65
|
resize(n + (end - start));
|
66
|
-
|
66
|
+
void* result = start + pos;
|
67
67
|
std::memmove(start + pos + n, start + pos, (end - start) - pos);
|
68
68
|
end += n;
|
69
69
|
return result;
|
@@ -32,6 +32,10 @@ var net = require('net');
|
|
32
32
|
var http = require('http');
|
33
33
|
|
34
34
|
var LineReader = require('phusion_passenger/line_reader').LineReader;
|
35
|
+
var ustLog = require('phusion_passenger/ustrouter_connector');
|
36
|
+
|
37
|
+
var instrumentModulePaths = [ 'phusion_passenger/log_express', 'phusion_passenger/log_mongodb'];
|
38
|
+
var instrumentedModules = [];
|
35
39
|
|
36
40
|
module.isApplicationLoader = true; // https://groups.google.com/forum/#!topic/compoundjs/4txxkNtROQg
|
37
41
|
GLOBAL.PhusionPassenger = exports.PhusionPassenger = new EventEmitter();
|
@@ -76,13 +80,62 @@ function readOptions() {
|
|
76
80
|
readNextOption();
|
77
81
|
}
|
78
82
|
|
83
|
+
function passengerToWinstonLogLevel(passengerLogLevel) {
|
84
|
+
switch (passengerLogLevel) {
|
85
|
+
case "1":
|
86
|
+
return "error";
|
87
|
+
case "2":
|
88
|
+
return "warn";
|
89
|
+
case "3": // notice
|
90
|
+
case "4": // info
|
91
|
+
return "info";
|
92
|
+
case "5": // debug
|
93
|
+
return "verbose";
|
94
|
+
case "6": // debug2
|
95
|
+
return "debug";
|
96
|
+
case "7": // debug3
|
97
|
+
return "silly";
|
98
|
+
case "0": // crit
|
99
|
+
default:
|
100
|
+
break;
|
101
|
+
}
|
102
|
+
|
103
|
+
return "none";
|
104
|
+
}
|
105
|
+
|
79
106
|
function setupEnvironment(options) {
|
80
107
|
PhusionPassenger.options = options;
|
81
108
|
PhusionPassenger.configure = configure;
|
82
109
|
PhusionPassenger._appInstalled = false;
|
110
|
+
|
111
|
+
var logLevel = passengerToWinstonLogLevel(PhusionPassenger.options.log_level);
|
112
|
+
var winston = require("vendor-copy/winston");
|
113
|
+
var logger = new (winston.Logger)({
|
114
|
+
transports: [
|
115
|
+
new (winston.transports.Console)({ level: logLevel, debugStdout: true })
|
116
|
+
]
|
117
|
+
});
|
118
|
+
|
83
119
|
process.title = 'Passenger NodeApp: ' + options.app_root;
|
84
120
|
http.Server.prototype.originalListen = http.Server.prototype.listen;
|
85
121
|
http.Server.prototype.listen = installServer;
|
122
|
+
|
123
|
+
ustLog.init(logger, PhusionPassenger.options.ust_router_address, PhusionPassenger.options.ust_router_username,
|
124
|
+
PhusionPassenger.options.ust_router_password, PhusionPassenger.options.union_station_key, PhusionPassenger.options.app_group_name);
|
125
|
+
|
126
|
+
if (ustLog.isEnabled()) {
|
127
|
+
// must be first so other modules can use the cls context
|
128
|
+
require('vendor-copy/continuation-local-storage').createNamespace('passenger-request-ctx');
|
129
|
+
|
130
|
+
global.phusion_passenger_ustReporter = require('phusion_passenger/ustreporter');
|
131
|
+
global.phusion_passenger_ustReporter.init(logger, options.app_root, ustLog);
|
132
|
+
|
133
|
+
instrumentModulePaths.forEach(function(modulePath) {
|
134
|
+
var module = require(modulePath);
|
135
|
+
instrumentedModules.push(module);
|
136
|
+
module.initPreLoad(logger, options.app_root, ustLog);
|
137
|
+
});
|
138
|
+
}
|
86
139
|
|
87
140
|
stdinReader.close();
|
88
141
|
stdinReader = undefined;
|
@@ -90,6 +143,12 @@ function setupEnvironment(options) {
|
|
90
143
|
process.stdin.resume();
|
91
144
|
|
92
145
|
loadApplication();
|
146
|
+
|
147
|
+
if (ustLog.isEnabled()) {
|
148
|
+
instrumentedModules.forEach(function(module) {
|
149
|
+
module.initPostLoad();
|
150
|
+
});
|
151
|
+
}
|
93
152
|
}
|
94
153
|
|
95
154
|
/**
|
@@ -303,6 +303,27 @@ int generated_cache_location_part(ngx_conf_t *cf, passenger_loc_conf_t *conf) {
|
|
303
303
|
}
|
304
304
|
|
305
305
|
|
306
|
+
|
307
|
+
if (conf->abort_websockets_on_process_shutdown != NGX_CONF_UNSET) {
|
308
|
+
len += sizeof("!~PASSENGER_ABORT_WEBSOCKETS_ON_PROCESS_SHUTDOWN: ") - 1;
|
309
|
+
len += conf->abort_websockets_on_process_shutdown
|
310
|
+
? sizeof("t\r\n") - 1
|
311
|
+
: sizeof("f\r\n") - 1;
|
312
|
+
}
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
if (conf->force_max_concurrent_requests_per_process != NGX_CONF_UNSET) {
|
317
|
+
end = ngx_snprintf(int_buf,
|
318
|
+
sizeof(int_buf) - 1,
|
319
|
+
"%d",
|
320
|
+
conf->force_max_concurrent_requests_per_process);
|
321
|
+
len += sizeof("!~PASSENGER_FORCE_MAX_CONCURRENT_REQUESTS_PER_PROCESS: ") - 1;
|
322
|
+
len += end - int_buf;
|
323
|
+
len += sizeof("\r\n") - 1;
|
324
|
+
}
|
325
|
+
|
326
|
+
|
306
327
|
|
307
328
|
/* Create string */
|
308
329
|
buf = pos = ngx_pnalloc(cf->pool, len);
|
@@ -666,6 +687,33 @@ if (buf == NULL) {
|
|
666
687
|
}
|
667
688
|
|
668
689
|
|
690
|
+
|
691
|
+
if (conf->abort_websockets_on_process_shutdown != NGX_CONF_UNSET) {
|
692
|
+
pos = ngx_copy(pos,
|
693
|
+
"!~PASSENGER_ABORT_WEBSOCKETS_ON_PROCESS_SHUTDOWN: ",
|
694
|
+
sizeof("!~PASSENGER_ABORT_WEBSOCKETS_ON_PROCESS_SHUTDOWN: ") - 1);
|
695
|
+
if (conf->abort_websockets_on_process_shutdown) {
|
696
|
+
pos = ngx_copy(pos, "t\r\n", sizeof("t\r\n") - 1);
|
697
|
+
} else {
|
698
|
+
pos = ngx_copy(pos, "f\r\n", sizeof("f\r\n") - 1);
|
699
|
+
}
|
700
|
+
}
|
701
|
+
|
702
|
+
|
703
|
+
|
704
|
+
if (conf->force_max_concurrent_requests_per_process != NGX_CONF_UNSET) {
|
705
|
+
pos = ngx_copy(pos,
|
706
|
+
"!~PASSENGER_FORCE_MAX_CONCURRENT_REQUESTS_PER_PROCESS: ",
|
707
|
+
sizeof("!~PASSENGER_FORCE_MAX_CONCURRENT_REQUESTS_PER_PROCESS: ") - 1);
|
708
|
+
end = ngx_snprintf(int_buf,
|
709
|
+
sizeof(int_buf) - 1,
|
710
|
+
"%d",
|
711
|
+
conf->force_max_concurrent_requests_per_process);
|
712
|
+
pos = ngx_copy(pos, int_buf, end - int_buf);
|
713
|
+
pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
|
714
|
+
}
|
715
|
+
|
716
|
+
|
669
717
|
|
670
718
|
conf->options_cache.data = buf;
|
671
719
|
conf->options_cache.len = pos - buf;
|
@@ -490,6 +490,26 @@
|
|
490
490
|
NULL
|
491
491
|
},
|
492
492
|
|
493
|
+
{
|
494
|
+
|
495
|
+
ngx_string("passenger_abort_websockets_on_process_shutdown"),
|
496
|
+
NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_FLAG,
|
497
|
+
ngx_conf_set_flag_slot,
|
498
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
499
|
+
offsetof(passenger_loc_conf_t, abort_websockets_on_process_shutdown),
|
500
|
+
NULL
|
501
|
+
},
|
502
|
+
|
503
|
+
{
|
504
|
+
|
505
|
+
ngx_string("passenger_force_max_concurrent_requests_per_process"),
|
506
|
+
NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
|
507
|
+
ngx_conf_set_num_slot,
|
508
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
509
|
+
offsetof(passenger_loc_conf_t, force_max_concurrent_requests_per_process),
|
510
|
+
NULL
|
511
|
+
},
|
512
|
+
|
493
513
|
{
|
494
514
|
|
495
515
|
ngx_string("passenger_fly_with"),
|