passenger 4.0.48 → 4.0.49
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/.editorconfig +36 -2
- data/.travis.yml +1 -1
- data/CHANGELOG +16 -0
- data/Rakefile +0 -1
- data/build/apache2.rb +4 -4
- data/build/common_library.rb +18 -18
- data/build/cplusplus_support.rb +2 -2
- data/build/documentation.rb +1 -1
- data/build/integration_tests.rb +12 -4
- data/build/misc.rb +12 -7
- data/build/packaging.rb +14 -14
- data/build/preprocessor.rb +10 -10
- data/build/rake_extensions.rb +11 -11
- data/build/ruby_extension.rb +2 -2
- data/dev/ci/inituidgid +24 -0
- data/dev/ci/run_jenkins.sh +57 -0
- data/dev/ci/run_rpm_tests.sh +77 -0
- data/dev/{run_travis.sh → ci/run_travis.sh} +60 -4
- data/doc/Users guide Nginx.txt +2 -2
- data/doc/users_guide_snippets/environment_variables.txt +0 -2
- data/doc/users_guide_snippets/tips.txt +20 -1
- data/ext/apache2/Bucket.cpp +18 -18
- data/ext/apache2/Bucket.h +4 -4
- data/ext/apache2/Configuration.cpp +7 -7
- data/ext/apache2/Configuration.hpp +43 -43
- data/ext/apache2/DirectoryMapper.h +5 -5
- data/ext/apache2/Hooks.cpp +142 -142
- data/ext/apache2/MergeDirConfig.cpp +40 -40
- data/ext/common/Account.h +17 -17
- data/ext/common/AccountsDatabase.h +9 -9
- data/ext/common/AgentsStarter.cpp +2 -2
- data/ext/common/AgentsStarter.h +40 -40
- data/ext/common/ApplicationPool2/Common.h +10 -6
- data/ext/common/ApplicationPool2/ComponentInfo.h +2 -2
- data/ext/common/ApplicationPool2/DirectSpawner.h +17 -17
- data/ext/common/ApplicationPool2/DummySpawner.h +5 -5
- data/ext/common/ApplicationPool2/Group.h +54 -38
- data/ext/common/ApplicationPool2/Implementation.cpp +76 -49
- data/ext/common/ApplicationPool2/Options.h +98 -91
- data/ext/common/ApplicationPool2/Pool.h +70 -69
- data/ext/common/ApplicationPool2/Process.h +21 -21
- data/ext/common/ApplicationPool2/Session.h +11 -11
- data/ext/common/ApplicationPool2/SmartSpawner.h +60 -60
- data/ext/common/ApplicationPool2/Socket.h +19 -19
- data/ext/common/ApplicationPool2/Spawner.h +64 -72
- data/ext/common/ApplicationPool2/SpawnerFactory.h +4 -4
- data/ext/common/ApplicationPool2/SuperGroup.h +41 -41
- data/ext/common/BackgroundEventLoop.cpp +1 -1
- data/ext/common/BackgroundEventLoop.h +2 -2
- data/ext/common/Constants.h +1 -1
- data/ext/common/EventedBufferedInput.h +5 -5
- data/ext/common/EventedClient.h +51 -51
- data/ext/common/EventedMessageServer.h +39 -39
- data/ext/common/EventedServer.h +32 -32
- data/ext/common/Exceptions.h +23 -23
- data/ext/common/FileDescriptor.h +18 -18
- data/ext/common/Logging.cpp +1 -1
- data/ext/common/MessageClient.h +27 -27
- data/ext/common/MessageReadersWriters.h +79 -79
- data/ext/common/MessageServer.h +59 -59
- data/ext/common/RandomGenerator.h +12 -12
- data/ext/common/ResourceLocator.h +8 -8
- data/ext/common/SafeLibev.h +54 -25
- data/ext/common/ServerInstanceDir.h +31 -31
- data/ext/common/StaticString.h +50 -48
- data/ext/common/Utils.cpp +73 -78
- data/ext/common/Utils.h +6 -6
- data/ext/common/Utils/Base64.cpp +3 -3
- data/ext/common/Utils/Base64.h +7 -7
- data/ext/common/Utils/BlockingQueue.h +9 -9
- data/ext/common/Utils/BufferedIO.h +17 -17
- data/ext/common/Utils/CachedFileStat.hpp +16 -16
- data/ext/common/Utils/Dechunker.h +25 -25
- data/ext/common/Utils/FileChangeChecker.h +10 -10
- data/ext/common/Utils/MemZeroGuard.h +5 -5
- data/ext/common/Utils/MemoryBarrier.h +1 -1
- data/ext/common/Utils/MessageIO.h +61 -61
- data/ext/common/Utils/ProcessMetricsCollector.h +40 -40
- data/ext/common/Utils/ScopeGuard.h +7 -7
- data/ext/common/Utils/SpeedMeter.h +1 -1
- data/ext/common/Utils/StrIntUtils.cpp +13 -13
- data/ext/common/Utils/StrIntUtils.h +3 -3
- data/ext/common/Utils/StringScanning.h +5 -5
- data/ext/common/Utils/SystemMetricsCollector.h +2 -2
- data/ext/common/Utils/SystemTime.h +10 -10
- data/ext/common/Utils/Template.h +2 -2
- data/ext/common/Utils/Timer.h +6 -6
- data/ext/common/Utils/VariantMap.h +29 -29
- data/ext/common/agents/Base.cpp +19 -19
- data/ext/common/agents/HelperAgent/AgentOptions.h +1 -1
- data/ext/common/agents/HelperAgent/FileBackedPipe.h +6 -6
- data/ext/common/agents/HelperAgent/Main.cpp +44 -43
- data/ext/common/agents/HelperAgent/RequestHandler.cpp +4 -4
- data/ext/common/agents/HelperAgent/RequestHandler.h +29 -28
- data/ext/common/agents/HelperAgent/ScgiRequestParser.h +56 -50
- data/ext/common/agents/LoggingAgent/AdminController.h +8 -8
- data/ext/common/agents/LoggingAgent/DataStoreId.h +17 -17
- data/ext/common/agents/LoggingAgent/FilterSupport.h +167 -167
- data/ext/common/agents/LoggingAgent/LoggingServer.h +122 -122
- data/ext/common/agents/LoggingAgent/Main.cpp +7 -7
- data/ext/common/agents/LoggingAgent/RemoteSender.h +54 -54
- data/ext/common/agents/SpawnPreparer.cpp +4 -4
- data/ext/common/agents/TempDirToucher.c +2 -2
- data/ext/common/agents/Watchdog/AgentWatcher.cpp +47 -47
- data/ext/common/agents/Watchdog/HelperAgentWatcher.cpp +7 -7
- data/ext/common/agents/Watchdog/LoggingAgentWatcher.cpp +7 -7
- data/ext/common/agents/Watchdog/Main.cpp +22 -22
- data/ext/common/agents/Watchdog/ServerInstanceDirToucher.cpp +9 -9
- data/ext/libeio/eio.c +1 -1
- data/ext/nginx/Configuration.c +30 -30
- data/ext/nginx/Configuration.h +1 -1
- data/ext/nginx/ContentHandler.c +54 -54
- data/ext/nginx/ContentHandler.h +3 -3
- data/ext/nginx/StaticContentHandler.c +2 -2
- data/ext/nginx/ngx_http_passenger_module.c +21 -21
- data/ext/oxt/detail/backtrace_enabled.hpp +1 -1
- data/ext/oxt/detail/context.hpp +1 -1
- data/ext/oxt/detail/spin_lock_darwin.hpp +4 -4
- data/ext/oxt/detail/spin_lock_gcc_x86.hpp +3 -3
- data/ext/oxt/detail/spin_lock_pthreads.hpp +4 -4
- data/ext/oxt/detail/tracable_exception_disabled.hpp +1 -1
- data/ext/oxt/dynamic_thread_group.hpp +18 -18
- data/ext/oxt/implementation.cpp +9 -8
- data/ext/oxt/macros.hpp +2 -2
- data/ext/oxt/system_calls.cpp +11 -11
- data/ext/oxt/system_calls.hpp +13 -13
- data/ext/oxt/thread.hpp +22 -14
- data/ext/ruby/passenger_native_support.c +55 -55
- data/lib/phusion_passenger.rb +24 -24
- data/lib/phusion_passenger/common_library.rb +2 -0
- data/lib/phusion_passenger/loader_shared_helpers.rb +18 -18
- data/lib/phusion_passenger/packaging.rb +9 -4
- data/lib/phusion_passenger/platform_info/apache.rb +45 -31
- data/lib/phusion_passenger/platform_info/compiler.rb +11 -11
- data/lib/phusion_passenger/rack/thread_handler_extension.rb +1 -1
- data/lib/phusion_passenger/request_handler/thread_handler.rb +8 -8
- data/lib/phusion_passenger/standalone/app_finder.rb +16 -16
- data/lib/phusion_passenger/standalone/command.rb +22 -22
- data/packaging/rpm/LICENSE.txt +19 -0
- data/packaging/rpm/Makefile +13 -0
- data/packaging/rpm/README.md +41 -0
- data/packaging/rpm/Vagrantfile +38 -0
- data/{rpm/Vagrantfile → packaging/rpm/Vagrantfile.centos} +0 -0
- data/packaging/rpm/build +170 -0
- data/packaging/rpm/create_project +41 -0
- data/packaging/rpm/git_update +88 -0
- data/packaging/rpm/image/Dockerfile +37 -0
- data/packaging/rpm/image/Gemfile +3 -0
- data/packaging/rpm/image/Gemfile.lock +12 -0
- data/packaging/rpm/image/RPM-GPG-KEY-amazon-ga +19 -0
- data/packaging/rpm/image/amazon2014-i386.cfg +96 -0
- data/packaging/rpm/image/amazon2014-x86_64.cfg +96 -0
- data/packaging/rpm/image/site-defaults.cfg +168 -0
- data/packaging/rpm/internal/build_tasks.rb +238 -0
- data/packaging/rpm/internal/dummygpg +11 -0
- data/packaging/rpm/internal/exec_build +42 -0
- data/packaging/rpm/internal/get_distro_arch +14 -0
- data/packaging/rpm/internal/get_distro_id +10 -0
- data/packaging/rpm/internal/git_update +27 -0
- data/packaging/rpm/internal/inituidgid +17 -0
- data/packaging/rpm/internal/my_init +344 -0
- data/packaging/rpm/internal/python27 +3 -0
- data/packaging/rpm/internal/repo_update +46 -0
- data/packaging/rpm/internal/setuser +26 -0
- data/packaging/rpm/internal/tracking_helper +40 -0
- data/packaging/rpm/jenkins_release +99 -0
- data/packaging/rpm/lib/build_tasks_support.rb +402 -0
- data/packaging/rpm/lib/preprocessor.rb +341 -0
- data/packaging/rpm/nginx_spec/404.html +119 -0
- data/packaging/rpm/nginx_spec/50x.html +119 -0
- data/packaging/rpm/nginx_spec/index.html +116 -0
- data/packaging/rpm/nginx_spec/nginx-auto-cc-gcc.patch +13 -0
- data/packaging/rpm/nginx_spec/nginx-logo.png +0 -0
- data/packaging/rpm/nginx_spec/nginx-upgrade +13 -0
- data/packaging/rpm/nginx_spec/nginx-upgrade.8 +151 -0
- data/packaging/rpm/nginx_spec/nginx.conf +131 -0
- data/packaging/rpm/nginx_spec/nginx.init +144 -0
- data/packaging/rpm/nginx_spec/nginx.logrotate +13 -0
- data/packaging/rpm/nginx_spec/nginx.service +15 -0
- data/packaging/rpm/nginx_spec/nginx.spec.template +559 -0
- data/packaging/rpm/nginx_spec/nginx.sysconfig +4 -0
- data/packaging/rpm/nginx_spec/passenger.conf +9 -0
- data/packaging/rpm/nginx_spec/poweredby.png +0 -0
- data/{rpm → packaging/rpm/passenger_spec}/apache-passenger.conf.in +0 -0
- data/{rpm → packaging/rpm/passenger_spec}/config.json +0 -0
- data/{rpm → packaging/rpm/passenger_spec}/passenger.logrotate +0 -0
- data/{rpm → packaging/rpm/passenger_spec}/passenger.spec.template +58 -31
- data/{rpm → packaging/rpm/passenger_spec}/passenger_dynamic_thread_group.patch +0 -0
- data/{rpm → packaging/rpm/passenger_spec}/passenger_tests_default_config_example.patch +0 -0
- data/{rpm → packaging/rpm/passenger_spec}/rubygem-passenger-4.0.18-GLIBC_HAVE_LONG_LONG.patch +0 -0
- data/{rpm → packaging/rpm/passenger_spec}/rubygem-passenger-4.0.18-gcc47-include-sys_types.patch +0 -0
- data/packaging/rpm/repo_update +114 -0
- data/packaging/rpm/setup-system +60 -0
- data/packaging/rpm/shell +10 -0
- data/resources/templates/standalone/config.erb +3 -1
- data/test/config.json.rpm-automation +1 -1
- data/test/cxx/ApplicationPool2/DirectSpawnerTest.cpp +11 -11
- data/test/cxx/ApplicationPool2/OptionsTest.cpp +5 -5
- data/test/cxx/ApplicationPool2/PoolTest.cpp +129 -89
- data/test/cxx/ApplicationPool2/ProcessTest.cpp +15 -15
- data/test/cxx/ApplicationPool2/SmartSpawnerTest.cpp +22 -22
- data/test/cxx/ApplicationPool2/SpawnerTestCases.cpp +11 -11
- data/test/cxx/ScgiRequestParserTest.cpp +75 -61
- data/test/cxx/UtilsTest.cpp +86 -85
- data/test/gdbinit.example +3 -0
- data/test/integration_tests/nginx_tests.rb +3 -3
- data/test/integration_tests/source_packaging_test.rb +3 -1
- data/test/stub/nginx/nginx.conf.erb +8 -1
- data/test/support/nginx_controller.rb +7 -7
- metadata +62 -17
- metadata.gz.asc +7 -7
- data/build/rpm.rb +0 -128
- data/dev/rpmtool +0 -21
- data/dev/test_rpm_packaging.sh +0 -28
- data/rpm/get_distro_id.py +0 -4
@@ -128,9 +128,9 @@ public:
|
|
128
128
|
mutable boost::mutex syncher;
|
129
129
|
unsigned int max;
|
130
130
|
unsigned long long maxIdleTime;
|
131
|
-
|
131
|
+
|
132
132
|
boost::condition_variable garbageCollectionCond;
|
133
|
-
|
133
|
+
|
134
134
|
/**
|
135
135
|
* Code can register background threads in one of these dynamic thread groups
|
136
136
|
* to ensure that threads are interrupted and/or joined properly upon Pool
|
@@ -149,9 +149,9 @@ public:
|
|
149
149
|
SHUTTING_DOWN,
|
150
150
|
SHUT_DOWN
|
151
151
|
} lifeStatus;
|
152
|
-
|
152
|
+
|
153
153
|
SuperGroupMap superGroups;
|
154
|
-
|
154
|
+
|
155
155
|
/**
|
156
156
|
* get() requests that...
|
157
157
|
* - cannot be immediately satisfied because the pool is at full
|
@@ -192,14 +192,14 @@ public:
|
|
192
192
|
|
193
193
|
const VariantMap *agentsOptions;
|
194
194
|
DebugSupportPtr debugSupport;
|
195
|
-
|
195
|
+
|
196
196
|
static void runAllActions(const vector<Callback> &actions) {
|
197
197
|
vector<Callback>::const_iterator it, end = actions.end();
|
198
198
|
for (it = actions.begin(); it != end; it++) {
|
199
199
|
(*it)();
|
200
200
|
}
|
201
201
|
}
|
202
|
-
|
202
|
+
|
203
203
|
static void runAllActionsWithCopy(vector<Callback> actions) {
|
204
204
|
runAllActions(actions);
|
205
205
|
}
|
@@ -211,13 +211,13 @@ public:
|
|
211
211
|
return "";
|
212
212
|
}
|
213
213
|
}
|
214
|
-
|
214
|
+
|
215
215
|
void verifyInvariants() const {
|
216
216
|
// !a || b: logical equivalent of a IMPLIES b.
|
217
217
|
assert(!( !getWaitlist.empty() ) || ( atFullCapacity(false) ));
|
218
218
|
assert(!( !atFullCapacity(false) ) || ( getWaitlist.empty() ));
|
219
219
|
}
|
220
|
-
|
220
|
+
|
221
221
|
void verifyExpensiveInvariants() const {
|
222
222
|
#ifndef NDEBUG
|
223
223
|
vector<GetWaiter>::const_iterator it, end = getWaitlist.end();
|
@@ -244,7 +244,7 @@ public:
|
|
244
244
|
}
|
245
245
|
}
|
246
246
|
}
|
247
|
-
|
247
|
+
|
248
248
|
bool runHookScripts(const char *name,
|
249
249
|
const boost::function<void (HookScriptOptions &)> &setup) const
|
250
250
|
{
|
@@ -288,7 +288,7 @@ public:
|
|
288
288
|
|
289
289
|
ProcessPtr findOldestIdleProcess(const Group *exclude = NULL) const {
|
290
290
|
ProcessPtr oldestIdleProcess;
|
291
|
-
|
291
|
+
|
292
292
|
SuperGroupMap::const_iterator it, end = superGroups.end();
|
293
293
|
for (it = superGroups.begin(); it != end; it++) {
|
294
294
|
const SuperGroupPtr &superGroup = it->second;
|
@@ -312,13 +312,13 @@ public:
|
|
312
312
|
}
|
313
313
|
}
|
314
314
|
}
|
315
|
-
|
315
|
+
|
316
316
|
return oldestIdleProcess;
|
317
317
|
}
|
318
|
-
|
318
|
+
|
319
319
|
ProcessPtr findBestProcessToTrash() const {
|
320
320
|
ProcessPtr oldestProcess;
|
321
|
-
|
321
|
+
|
322
322
|
SuperGroupMap::const_iterator it, end = superGroups.end();
|
323
323
|
for (it = superGroups.begin(); it != end; it++) {
|
324
324
|
const SuperGroupPtr &superGroup = it->second;
|
@@ -337,10 +337,10 @@ public:
|
|
337
337
|
}
|
338
338
|
}
|
339
339
|
}
|
340
|
-
|
340
|
+
|
341
341
|
return oldestProcess;
|
342
342
|
}
|
343
|
-
|
343
|
+
|
344
344
|
/** Process all waiters on the getWaitlist. Call when capacity has become free.
|
345
345
|
* This function assigns sessions to them by calling get() on the corresponding
|
346
346
|
* SuperGroups, or by creating more SuperGroups, in so far the new capacity allows.
|
@@ -390,7 +390,7 @@ public:
|
|
390
390
|
getWaitlist.pop_front();
|
391
391
|
}
|
392
392
|
}
|
393
|
-
|
393
|
+
|
394
394
|
void possiblySpawnMoreProcessesForExistingGroups() {
|
395
395
|
StringMap<SuperGroupPtr>::const_iterator sg_it, sg_end = superGroups.end();
|
396
396
|
/* Looks for Groups that are waiting for capacity to become available,
|
@@ -424,7 +424,7 @@ public:
|
|
424
424
|
}
|
425
425
|
}
|
426
426
|
}
|
427
|
-
|
427
|
+
|
428
428
|
void migrateSuperGroupGetWaitlistToPool(const SuperGroupPtr &superGroup) {
|
429
429
|
getWaitlist.reserve(getWaitlist.size() + superGroup->getWaitlist.size());
|
430
430
|
while (!superGroup->getWaitlist.empty()) {
|
@@ -456,7 +456,7 @@ public:
|
|
456
456
|
}
|
457
457
|
return process;
|
458
458
|
}
|
459
|
-
|
459
|
+
|
460
460
|
/**
|
461
461
|
* Forcefully destroys and detaches the given SuperGroup. After detaching
|
462
462
|
* the SuperGroup may have a non-empty getWaitlist so be sure to do
|
@@ -479,7 +479,7 @@ public:
|
|
479
479
|
bool detachProcessUnlocked(const ProcessPtr &process, vector<Callback> &postLockActions) {
|
480
480
|
if (OXT_LIKELY(process->isAlive())) {
|
481
481
|
verifyInvariants();
|
482
|
-
|
482
|
+
|
483
483
|
const GroupPtr group = process->getGroup();
|
484
484
|
const SuperGroupPtr superGroup = group->getSuperGroup();
|
485
485
|
assert(superGroup->state != SuperGroup::INITIALIZING);
|
@@ -494,13 +494,13 @@ public:
|
|
494
494
|
superGroup->verifyInvariants();
|
495
495
|
verifyInvariants();
|
496
496
|
verifyExpensiveInvariants();
|
497
|
-
|
497
|
+
|
498
498
|
return true;
|
499
499
|
} else {
|
500
500
|
return false;
|
501
501
|
}
|
502
502
|
}
|
503
|
-
|
503
|
+
|
504
504
|
void inspectProcessList(const InspectOptions &options, stringstream &result,
|
505
505
|
const Group *group, const ProcessList &processes) const
|
506
506
|
{
|
@@ -510,7 +510,7 @@ public:
|
|
510
510
|
char buf[128];
|
511
511
|
char cpubuf[10];
|
512
512
|
char membuf[10];
|
513
|
-
|
513
|
+
|
514
514
|
snprintf(cpubuf, sizeof(cpubuf), "%d%%", (int) process->metrics.cpu);
|
515
515
|
snprintf(membuf, sizeof(membuf), "%ldM",
|
516
516
|
(unsigned long) (process->metrics.realMemory() / 1024));
|
@@ -598,7 +598,7 @@ public:
|
|
598
598
|
}
|
599
599
|
ticket->cond.notify_one();
|
600
600
|
}
|
601
|
-
|
601
|
+
|
602
602
|
SuperGroup *findMatchingSuperGroup(const Options &options) {
|
603
603
|
return superGroups.get(options.getAppGroupName()).get();
|
604
604
|
}
|
@@ -620,6 +620,7 @@ public:
|
|
620
620
|
try {
|
621
621
|
UPDATE_TRACE_POINT();
|
622
622
|
unsigned long long sleepTime = self->realGarbageCollect();
|
623
|
+
UPDATE_TRACE_POINT();
|
623
624
|
ScopedLock lock(self->syncher);
|
624
625
|
self->garbageCollectionCond.timed_wait(lock,
|
625
626
|
posix_time::microseconds(sleepTime));
|
@@ -679,18 +680,18 @@ public:
|
|
679
680
|
GarbageCollectorState state;
|
680
681
|
state.now = SystemTime::getUsec();
|
681
682
|
state.nextGcRunTime = 0;
|
682
|
-
|
683
|
+
|
683
684
|
P_DEBUG("Garbage collection time...");
|
684
685
|
verifyInvariants();
|
685
|
-
|
686
|
+
|
686
687
|
// For all supergroups and groups...
|
687
688
|
for (it = superGroups.begin(); it != end; it++) {
|
688
689
|
SuperGroupPtr superGroup = it->second;
|
689
690
|
vector<GroupPtr> &groups = superGroup->groups;
|
690
691
|
vector<GroupPtr>::iterator g_it, g_end = groups.end();
|
691
|
-
|
692
|
+
|
692
693
|
superGroup->verifyInvariants();
|
693
|
-
|
694
|
+
|
694
695
|
for (g_it = groups.begin(); g_it != g_end; g_it++) {
|
695
696
|
GroupPtr group = *g_it;
|
696
697
|
|
@@ -704,16 +705,16 @@ public:
|
|
704
705
|
maybeDetachIdleProcess(state, group, process, p_it);
|
705
706
|
}
|
706
707
|
}
|
707
|
-
|
708
|
+
|
708
709
|
group->verifyInvariants();
|
709
|
-
|
710
|
+
|
710
711
|
// ...cleanup the spawner if it's been idle for more than preloaderIdleTime.
|
711
712
|
maybeCleanPreloader(state, group);
|
712
713
|
}
|
713
|
-
|
714
|
+
|
714
715
|
superGroup->verifyInvariants();
|
715
716
|
}
|
716
|
-
|
717
|
+
|
717
718
|
verifyInvariants();
|
718
719
|
lock.unlock();
|
719
720
|
|
@@ -832,7 +833,7 @@ public:
|
|
832
833
|
this_thread::disable_syscall_interruption dsi;
|
833
834
|
vector<pid_t> pids;
|
834
835
|
unsigned int max;
|
835
|
-
|
836
|
+
|
836
837
|
P_DEBUG("Analytics collection time...");
|
837
838
|
// Collect all the PIDs.
|
838
839
|
{
|
@@ -845,7 +846,7 @@ public:
|
|
845
846
|
UPDATE_TRACE_POINT();
|
846
847
|
LockGuard l(syncher);
|
847
848
|
SuperGroupMap::const_iterator sg_it, sg_end = superGroups.end();
|
848
|
-
|
849
|
+
|
849
850
|
for (sg_it = superGroups.begin(); sg_it != sg_end; sg_it++) {
|
850
851
|
const SuperGroupPtr &superGroup = sg_it->second;
|
851
852
|
vector<GroupPtr>::const_iterator g_it, g_end = superGroup->groups.end();
|
@@ -858,7 +859,7 @@ public:
|
|
858
859
|
}
|
859
860
|
}
|
860
861
|
}
|
861
|
-
|
862
|
+
|
862
863
|
// Collect process metrics and system and store them in the
|
863
864
|
// data structures. Later, we log them to Union Station.
|
864
865
|
ProcessMetricMap processMetrics;
|
@@ -884,7 +885,7 @@ public:
|
|
884
885
|
vector<Callback> actions;
|
885
886
|
ScopedLock l(syncher);
|
886
887
|
SuperGroupMap::iterator sg_it, sg_end = superGroups.end();
|
887
|
-
|
888
|
+
|
888
889
|
UPDATE_TRACE_POINT();
|
889
890
|
for (sg_it = superGroups.begin(); sg_it != sg_end; sg_it++) {
|
890
891
|
const SuperGroupPtr &superGroup = sg_it->second;
|
@@ -930,7 +931,7 @@ public:
|
|
930
931
|
// Run destructors with updated trace point.
|
931
932
|
actions.clear();
|
932
933
|
}
|
933
|
-
|
934
|
+
|
934
935
|
end:
|
935
936
|
// Sleep for about 4 seconds, aligned to seconds boundary
|
936
937
|
// for saving power on laptops.
|
@@ -942,7 +943,7 @@ public:
|
|
942
943
|
" sec");
|
943
944
|
return deadline - currentTime;
|
944
945
|
}
|
945
|
-
|
946
|
+
|
946
947
|
SuperGroupPtr createSuperGroup(const Options &options) {
|
947
948
|
SuperGroupPtr superGroup = boost::make_shared<SuperGroup>(shared_from_this(),
|
948
949
|
options);
|
@@ -951,7 +952,7 @@ public:
|
|
951
952
|
garbageCollectionCond.notify_all();
|
952
953
|
return superGroup;
|
953
954
|
}
|
954
|
-
|
955
|
+
|
955
956
|
SuperGroupPtr createSuperGroupAndAsyncGetFromIt(const Options &options,
|
956
957
|
const GetCallback &callback, vector<Callback> &postLockActions)
|
957
958
|
{
|
@@ -968,7 +969,7 @@ public:
|
|
968
969
|
|
969
970
|
// Debugging helper function, implemented in .cpp file so that GDB can access it.
|
970
971
|
const SuperGroupPtr getSuperGroup(const char *name);
|
971
|
-
|
972
|
+
|
972
973
|
public:
|
973
974
|
Pool(const SpawnerFactoryPtr &spawnerFactory,
|
974
975
|
const VariantMap *agentsOptions = NULL)
|
@@ -985,7 +986,7 @@ public:
|
|
985
986
|
lifeStatus = ALIVE;
|
986
987
|
max = 6;
|
987
988
|
maxIdleTime = 60 * 1000000;
|
988
|
-
|
989
|
+
|
989
990
|
// The following code only serve to instantiate certain inline methods
|
990
991
|
// so that they can be invoked from gdb.
|
991
992
|
(void) SuperGroupPtr().get();
|
@@ -993,7 +994,7 @@ public:
|
|
993
994
|
(void) ProcessPtr().get();
|
994
995
|
(void) SessionPtr().get();
|
995
996
|
}
|
996
|
-
|
997
|
+
|
997
998
|
~Pool() {
|
998
999
|
if (lifeStatus != SHUT_DOWN) {
|
999
1000
|
P_BUG("You must call Pool::destroy() before actually destroying the Pool object!");
|
@@ -1093,7 +1094,7 @@ public:
|
|
1093
1094
|
if (session != NULL) {
|
1094
1095
|
callback(session, ExceptionPtr());
|
1095
1096
|
}
|
1096
|
-
|
1097
|
+
|
1097
1098
|
} else if (!atFullCapacity(false)) {
|
1098
1099
|
/* The app super group isn't in the pool and we have enough free
|
1099
1100
|
* resources to make a new one.
|
@@ -1104,7 +1105,7 @@ public:
|
|
1104
1105
|
superGroup->verifyInvariants();
|
1105
1106
|
verifyInvariants();
|
1106
1107
|
P_DEBUG("asyncGet() finished");
|
1107
|
-
|
1108
|
+
|
1108
1109
|
} else {
|
1109
1110
|
/* Uh oh, the app super group isn't in the pool but we don't
|
1110
1111
|
* have the resources to make a new one. The sysadmin should
|
@@ -1144,7 +1145,7 @@ public:
|
|
1144
1145
|
freedProcess->getGroup()->verifyInvariants();
|
1145
1146
|
superGroup->verifyInvariants();
|
1146
1147
|
}
|
1147
|
-
|
1148
|
+
|
1148
1149
|
assert(atFullCapacity(false));
|
1149
1150
|
verifyInvariants();
|
1150
1151
|
verifyExpensiveInvariants();
|
@@ -1165,20 +1166,20 @@ public:
|
|
1165
1166
|
}
|
1166
1167
|
}
|
1167
1168
|
}
|
1168
|
-
|
1169
|
+
|
1169
1170
|
// TODO: 'ticket' should be a boost::shared_ptr for interruption-safety.
|
1170
1171
|
SessionPtr get(const Options &options, Ticket *ticket) {
|
1171
1172
|
ticket->session.reset();
|
1172
1173
|
ticket->exception.reset();
|
1173
|
-
|
1174
|
+
|
1174
1175
|
asyncGet(options, boost::bind(syncGetCallback, ticket, _1, _2));
|
1175
|
-
|
1176
|
+
|
1176
1177
|
ScopedLock lock(ticket->syncher);
|
1177
1178
|
while (ticket->session == NULL && ticket->exception == NULL) {
|
1178
1179
|
ticket->cond.wait(lock);
|
1179
1180
|
}
|
1180
1181
|
lock.unlock();
|
1181
|
-
|
1182
|
+
|
1182
1183
|
if (OXT_LIKELY(ticket->session != NULL)) {
|
1183
1184
|
SessionPtr session = ticket->session;
|
1184
1185
|
ticket->session.reset();
|
@@ -1188,11 +1189,11 @@ public:
|
|
1188
1189
|
return SessionPtr(); // Shut up compiler warning.
|
1189
1190
|
}
|
1190
1191
|
}
|
1191
|
-
|
1192
|
+
|
1192
1193
|
GroupPtr findOrCreateGroup(const Options &options) {
|
1193
1194
|
Options options2 = options;
|
1194
1195
|
options2.noop = true;
|
1195
|
-
|
1196
|
+
|
1196
1197
|
Ticket ticket;
|
1197
1198
|
{
|
1198
1199
|
LockGuard l(syncher);
|
@@ -1204,7 +1205,7 @@ public:
|
|
1204
1205
|
}
|
1205
1206
|
return get(options2, &ticket)->getGroup();
|
1206
1207
|
}
|
1207
|
-
|
1208
|
+
|
1208
1209
|
void setMax(unsigned int max) {
|
1209
1210
|
ScopedLock l(syncher);
|
1210
1211
|
assert(max > 0);
|
@@ -1224,7 +1225,7 @@ public:
|
|
1224
1225
|
vector<Callback> actions;
|
1225
1226
|
assignSessionsToGetWaiters(actions);
|
1226
1227
|
possiblySpawnMoreProcessesForExistingGroups();
|
1227
|
-
|
1228
|
+
|
1228
1229
|
fullVerifyInvariants();
|
1229
1230
|
l.unlock();
|
1230
1231
|
runAllActions(actions);
|
@@ -1238,7 +1239,7 @@ public:
|
|
1238
1239
|
maxIdleTime = value;
|
1239
1240
|
garbageCollectionCond.notify_all();
|
1240
1241
|
}
|
1241
|
-
|
1242
|
+
|
1242
1243
|
unsigned int capacityUsed(bool lock = true) const {
|
1243
1244
|
DynamicScopedLock l(syncher, lock);
|
1244
1245
|
SuperGroupMap::const_iterator it, end = superGroups.end();
|
@@ -1249,7 +1250,7 @@ public:
|
|
1249
1250
|
}
|
1250
1251
|
return result;
|
1251
1252
|
}
|
1252
|
-
|
1253
|
+
|
1253
1254
|
bool atFullCapacity(bool lock = true) const {
|
1254
1255
|
DynamicScopedLock l(syncher, lock);
|
1255
1256
|
return capacityUsed(false) >= max;
|
@@ -1280,7 +1281,7 @@ public:
|
|
1280
1281
|
}
|
1281
1282
|
return result;
|
1282
1283
|
}
|
1283
|
-
|
1284
|
+
|
1284
1285
|
/**
|
1285
1286
|
* Returns the total number of processes in the pool, including all disabling and
|
1286
1287
|
* disabled processes, but excluding processes that are shutting down and excluding
|
@@ -1301,7 +1302,7 @@ public:
|
|
1301
1302
|
LockGuard l(syncher);
|
1302
1303
|
return superGroups.size();
|
1303
1304
|
}
|
1304
|
-
|
1305
|
+
|
1305
1306
|
SuperGroupPtr findSuperGroupBySecret(const string &secret, bool lock = true) const {
|
1306
1307
|
DynamicScopedLock l(syncher, lock);
|
1307
1308
|
SuperGroupMap::const_iterator it, end = superGroups.end();
|
@@ -1313,7 +1314,7 @@ public:
|
|
1313
1314
|
}
|
1314
1315
|
return SuperGroupPtr();
|
1315
1316
|
}
|
1316
|
-
|
1317
|
+
|
1317
1318
|
ProcessPtr findProcessByGupid(const string &gupid, bool lock = true) const {
|
1318
1319
|
vector<ProcessPtr> processes = getProcesses(lock);
|
1319
1320
|
vector<ProcessPtr>::const_iterator it, end = processes.end();
|
@@ -1341,14 +1342,14 @@ public:
|
|
1341
1342
|
bool detachSuperGroupByName(const string &name) {
|
1342
1343
|
TRACE_POINT();
|
1343
1344
|
ScopedLock l(syncher);
|
1344
|
-
|
1345
|
+
|
1345
1346
|
SuperGroupPtr superGroup = superGroups.get(name);
|
1346
1347
|
if (OXT_LIKELY(superGroup != NULL)) {
|
1347
1348
|
if (OXT_LIKELY(superGroups.get(superGroup->name) != NULL)) {
|
1348
1349
|
UPDATE_TRACE_POINT();
|
1349
1350
|
verifyInvariants();
|
1350
1351
|
verifyExpensiveInvariants();
|
1351
|
-
|
1352
|
+
|
1352
1353
|
vector<Callback> actions;
|
1353
1354
|
boost::shared_ptr<DetachSuperGroupWaitTicket> ticket =
|
1354
1355
|
boost::make_shared<DetachSuperGroupWaitTicket>();
|
@@ -1366,15 +1367,15 @@ public:
|
|
1366
1367
|
* SuperGroup is essentially the same as restarting it.
|
1367
1368
|
*/
|
1368
1369
|
migrateSuperGroupGetWaitlistToPool(superGroup);
|
1369
|
-
|
1370
|
+
|
1370
1371
|
UPDATE_TRACE_POINT();
|
1371
1372
|
assignSessionsToGetWaiters(actions);
|
1372
1373
|
#endif
|
1373
1374
|
possiblySpawnMoreProcessesForExistingGroups();
|
1374
|
-
|
1375
|
+
|
1375
1376
|
verifyInvariants();
|
1376
1377
|
verifyExpensiveInvariants();
|
1377
|
-
|
1378
|
+
|
1378
1379
|
l.unlock();
|
1379
1380
|
UPDATE_TRACE_POINT();
|
1380
1381
|
runAllActions(actions);
|
@@ -1393,7 +1394,7 @@ public:
|
|
1393
1394
|
return false;
|
1394
1395
|
}
|
1395
1396
|
}
|
1396
|
-
|
1397
|
+
|
1397
1398
|
bool detachSuperGroupBySecret(const string &superGroupSecret) {
|
1398
1399
|
ScopedLock l(syncher);
|
1399
1400
|
SuperGroupPtr superGroup = findSuperGroupBySecret(superGroupSecret, false);
|
@@ -1406,7 +1407,7 @@ public:
|
|
1406
1407
|
return false;
|
1407
1408
|
}
|
1408
1409
|
}
|
1409
|
-
|
1410
|
+
|
1410
1411
|
bool detachProcess(const ProcessPtr &process) {
|
1411
1412
|
ScopedLock l(syncher);
|
1412
1413
|
vector<Callback> actions;
|
@@ -1529,7 +1530,7 @@ public:
|
|
1529
1530
|
stringstream result;
|
1530
1531
|
const char *headerColor = maybeColorize(options, ANSI_COLOR_YELLOW ANSI_COLOR_BLUE_BG ANSI_COLOR_BOLD);
|
1531
1532
|
const char *resetColor = maybeColorize(options, ANSI_COLOR_RESET);
|
1532
|
-
|
1533
|
+
|
1533
1534
|
result << headerColor << "----------- General information -----------" << resetColor << endl;
|
1534
1535
|
result << "Max pool size : " << max << endl;
|
1535
1536
|
result << "Processes : " << getProcessCount(false) << endl;
|
@@ -1542,14 +1543,14 @@ public:
|
|
1542
1543
|
}
|
1543
1544
|
}
|
1544
1545
|
result << endl;
|
1545
|
-
|
1546
|
+
|
1546
1547
|
result << headerColor << "----------- Application groups -----------" << resetColor << endl;
|
1547
1548
|
SuperGroupMap::const_iterator sg_it, sg_end = superGroups.end();
|
1548
1549
|
for (sg_it = superGroups.begin(); sg_it != sg_end; sg_it++) {
|
1549
1550
|
const SuperGroupPtr &superGroup = sg_it->second;
|
1550
1551
|
const Group *group = superGroup->defaultGroup;
|
1551
1552
|
ProcessList::const_iterator p_it;
|
1552
|
-
|
1553
|
+
|
1553
1554
|
if (group != NULL) {
|
1554
1555
|
result << group->name << ":" << endl;
|
1555
1556
|
result << " App root: " << group->options.appRoot << endl;
|
@@ -1585,7 +1586,7 @@ public:
|
|
1585
1586
|
|
1586
1587
|
result << "<?xml version=\"1.0\" encoding=\"iso8859-1\" ?>\n";
|
1587
1588
|
result << "<info version=\"3\">";
|
1588
|
-
|
1589
|
+
|
1589
1590
|
result << "<passenger_version>" << PASSENGER_VERSION << "</passenger_version>";
|
1590
1591
|
result << "<process_count>" << getProcessCount(false) << "</process_count>";
|
1591
1592
|
result << "<max>" << max << "</max>";
|
@@ -1604,7 +1605,7 @@ public:
|
|
1604
1605
|
}
|
1605
1606
|
result << "</get_wait_list>";
|
1606
1607
|
}
|
1607
|
-
|
1608
|
+
|
1608
1609
|
result << "<supergroups>";
|
1609
1610
|
for (sg_it = superGroups.begin(); sg_it != superGroups.end(); sg_it++) {
|
1610
1611
|
const SuperGroupPtr &superGroup = sg_it->second;
|