passenger 5.0.9 → 5.0.10

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.

Files changed (106) hide show
  1. checksums.yaml +8 -8
  2. checksums.yaml.gz.asc +7 -7
  3. data.tar.gz.asc +7 -7
  4. data/CHANGELOG +15 -0
  5. data/CONTRIBUTORS +6 -0
  6. data/README.md +1 -1
  7. data/bin/passenger-install-apache2-module +24 -11
  8. data/bin/passenger-status +29 -14
  9. data/build/agents.rb +12 -10
  10. data/build/cxx_tests.rb +30 -30
  11. data/doc/Design and Architecture.html +1 -10
  12. data/doc/Design and Architecture.txt +1 -6
  13. data/doc/Users guide Apache.html +1 -19
  14. data/doc/Users guide Apache.txt +1 -1
  15. data/doc/Users guide Nginx.html +2 -20
  16. data/doc/Users guide Nginx.txt +2 -2
  17. data/doc/users_guide_snippets/tips.txt +0 -9
  18. data/ext/common/ApplicationPool2/ApiKey.h +158 -0
  19. data/ext/common/ApplicationPool2/BasicGroupInfo.h +81 -0
  20. data/ext/common/ApplicationPool2/BasicProcessInfo.h +106 -0
  21. data/ext/common/ApplicationPool2/Common.h +5 -44
  22. data/ext/common/ApplicationPool2/Context.h +94 -0
  23. data/ext/common/ApplicationPool2/Group.h +130 -1205
  24. data/ext/common/ApplicationPool2/Group/InitializationAndShutdown.cpp +190 -0
  25. data/ext/common/ApplicationPool2/Group/InternalUtils.cpp +329 -0
  26. data/ext/common/ApplicationPool2/Group/LifetimeAndBasics.cpp +103 -0
  27. data/ext/common/ApplicationPool2/{Pool/Debug.h → Group/Miscellaneous.cpp} +40 -38
  28. data/ext/common/ApplicationPool2/Group/OutOfBandWork.cpp +323 -0
  29. data/ext/common/ApplicationPool2/Group/ProcessListManagement.cpp +606 -0
  30. data/ext/common/ApplicationPool2/Group/SessionManagement.cpp +337 -0
  31. data/ext/common/ApplicationPool2/Group/SpawningAndRestarting.cpp +478 -0
  32. data/ext/common/ApplicationPool2/Group/StateInspection.cpp +197 -0
  33. data/ext/common/ApplicationPool2/Group/Verification.cpp +159 -0
  34. data/ext/common/ApplicationPool2/Implementation.cpp +19 -1401
  35. data/ext/common/ApplicationPool2/Options.h +5 -5
  36. data/ext/common/ApplicationPool2/Pool.h +260 -815
  37. data/ext/common/ApplicationPool2/Pool/{AnalyticsCollection.h → AnalyticsCollection.cpp} +55 -56
  38. data/ext/common/ApplicationPool2/Pool/{GarbageCollection.h → GarbageCollection.cpp} +49 -49
  39. data/ext/common/ApplicationPool2/Pool/GeneralUtils.cpp +241 -0
  40. data/ext/common/ApplicationPool2/Pool/GroupUtils.cpp +276 -0
  41. data/ext/common/ApplicationPool2/Pool/InitializationAndShutdown.cpp +145 -0
  42. data/ext/common/ApplicationPool2/Pool/Miscellaneous.cpp +244 -0
  43. data/ext/common/ApplicationPool2/Pool/ProcessUtils.cpp +330 -0
  44. data/ext/common/ApplicationPool2/Pool/StateInspection.cpp +299 -0
  45. data/ext/common/ApplicationPool2/Process.h +399 -205
  46. data/ext/common/ApplicationPool2/Session.h +70 -28
  47. data/ext/common/ApplicationPool2/Socket.h +1 -0
  48. data/ext/common/Constants.h +11 -3
  49. data/ext/common/Exceptions.h +1 -1
  50. data/ext/common/Logging.cpp +9 -4
  51. data/ext/common/Logging.h +6 -0
  52. data/ext/common/ServerKit/HttpServer.h +225 -215
  53. data/ext/common/ServerKit/Server.h +57 -57
  54. data/ext/common/SpawningKit/BackgroundIOCapturer.h +160 -0
  55. data/ext/common/SpawningKit/Config.h +107 -0
  56. data/ext/common/{ApplicationPool2 → SpawningKit}/DirectSpawner.h +17 -16
  57. data/ext/common/{ApplicationPool2 → SpawningKit}/DummySpawner.h +33 -33
  58. data/ext/common/{ApplicationPool2/SpawnerFactory.h → SpawningKit/Factory.h} +17 -17
  59. data/ext/common/{ApplicationPool2/ComponentInfo.h → SpawningKit/Options.h} +8 -21
  60. data/ext/common/SpawningKit/PipeWatcher.h +148 -0
  61. data/ext/common/{ApplicationPool2/PipeWatcher.h → SpawningKit/Result.h} +15 -33
  62. data/ext/common/{ApplicationPool2 → SpawningKit}/SmartSpawner.h +52 -57
  63. data/ext/common/{ApplicationPool2 → SpawningKit}/Spawner.h +83 -371
  64. data/ext/common/SpawningKit/UserSwitchingRules.h +265 -0
  65. data/ext/common/Utils/BufferedIO.h +24 -0
  66. data/ext/common/{ApplicationPool2/SpawnObject.h → Utils/ClassUtils.h} +24 -51
  67. data/ext/common/Utils/IOUtils.cpp +70 -0
  68. data/ext/common/Utils/IOUtils.h +19 -0
  69. data/ext/common/Utils/JsonUtils.h +113 -0
  70. data/ext/common/Utils/StrIntUtils.h +29 -0
  71. data/ext/common/Utils/json.h +1 -1
  72. data/ext/common/agents/ApiServerUtils.h +941 -0
  73. data/ext/common/agents/HelperAgent/{AdminServer.h → ApiServer.h} +163 -365
  74. data/ext/common/agents/HelperAgent/Main.cpp +86 -88
  75. data/ext/common/agents/HelperAgent/OptionParser.h +9 -10
  76. data/ext/common/agents/HelperAgent/RequestHandler/BufferBody.cpp +3 -0
  77. data/ext/common/agents/HelperAgent/RequestHandler/ForwardResponse.cpp +2 -0
  78. data/ext/common/agents/HelperAgent/RequestHandler/Hooks.cpp +1 -1
  79. data/ext/common/agents/HelperAgent/RequestHandler/SendRequest.cpp +2 -2
  80. data/ext/common/agents/LoggingAgent/ApiServer.h +279 -0
  81. data/ext/common/agents/LoggingAgent/Main.cpp +41 -51
  82. data/ext/common/agents/LoggingAgent/OptionParser.h +11 -11
  83. data/ext/common/agents/Watchdog/ApiServer.h +311 -0
  84. data/ext/common/agents/Watchdog/Main.cpp +91 -65
  85. data/helper-scripts/prespawn +2 -0
  86. data/lib/phusion_passenger.rb +1 -1
  87. data/lib/phusion_passenger/admin_tools/instance.rb +1 -1
  88. data/lib/phusion_passenger/common_library.rb +27 -14
  89. data/lib/phusion_passenger/config/{admin_command_command.rb → api_call_command.rb} +19 -16
  90. data/lib/phusion_passenger/config/detach_process_command.rb +6 -3
  91. data/lib/phusion_passenger/config/main.rb +3 -5
  92. data/lib/phusion_passenger/config/reopen_logs_command.rb +29 -7
  93. data/lib/phusion_passenger/config/restart_app_command.rb +13 -4
  94. data/lib/phusion_passenger/config/utils.rb +15 -8
  95. data/lib/phusion_passenger/constants.rb +6 -2
  96. data/lib/phusion_passenger/platform_info/apache.rb +4 -0
  97. data/lib/phusion_passenger/platform_info/apache_detector.rb +18 -3
  98. data/resources/templates/apache2/mpm_unknown.txt.erb +20 -0
  99. metadata +42 -21
  100. metadata.gz.asc +7 -7
  101. data/ext/common/ApplicationPool2/Pool/GeneralUtils.h +0 -127
  102. data/ext/common/ApplicationPool2/Pool/Inspection.h +0 -219
  103. data/ext/common/ApplicationPool2/Pool/ProcessUtils.h +0 -85
  104. data/ext/common/ApplicationPool2/SuperGroup.h +0 -706
  105. data/ext/common/agents/LoggingAgent/AdminServer.h +0 -435
  106. data/ext/common/agents/Watchdog/AdminServer.h +0 -432
@@ -0,0 +1,20 @@
1
+ <red>WARNING:</red> <yellow>unable to autodetect Apache's MPM</yellow>
2
+
3
+ <%= PROGRAM_NAME %> has only been tested on Apache with the 'prefork', the
4
+ 'worker' and the 'event' MPM. However, this installer was not able to
5
+ automatically figure out the MPM that your Apache was compiled with.
6
+
7
+ This installer tried to autodetect the MPM by running
8
+ <b><%= @control_command %> -V</b>, but that command failed for some reason.
9
+ This may happen if your Apache installation is broken, or if your Apache
10
+ configuration file has errors.
11
+
12
+ Because at this point this installer is not sure whether your Apache
13
+ installation is compatible with <%= SHORT_PROGRAM_NAME %>, we recommend that you abort
14
+ this installer, run the above command and diagnose the problem before
15
+ continuing. If you cannot figure out what is wrong, please contact the vendor
16
+ that supplied your Apache installation (e.g. your operating system vendor) for
17
+ support.
18
+
19
+ <b>Press Ctrl-C to abort this installer (so that you can double-check on things).</b>
20
+ <b>Press Enter if you want to continue with installation anyway.</b>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passenger
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.9
4
+ version: 5.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phusion - http://www.phusion.nl/
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-03 00:00:00.000000000 Z
11
+ date: 2015-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -2444,32 +2444,39 @@ files:
2444
2444
  - ext/common/AccountsDatabase.h
2445
2445
  - ext/common/AgentsStarter.cpp
2446
2446
  - ext/common/AgentsStarter.h
2447
+ - ext/common/ApplicationPool2/ApiKey.h
2447
2448
  - ext/common/ApplicationPool2/AppTypes.cpp
2448
2449
  - ext/common/ApplicationPool2/AppTypes.h
2450
+ - ext/common/ApplicationPool2/BasicGroupInfo.h
2451
+ - ext/common/ApplicationPool2/BasicProcessInfo.h
2449
2452
  - ext/common/ApplicationPool2/Common.h
2450
- - ext/common/ApplicationPool2/ComponentInfo.h
2451
- - ext/common/ApplicationPool2/DirectSpawner.h
2452
- - ext/common/ApplicationPool2/DummySpawner.h
2453
+ - ext/common/ApplicationPool2/Context.h
2453
2454
  - ext/common/ApplicationPool2/ErrorRenderer.h
2454
2455
  - ext/common/ApplicationPool2/Group.h
2456
+ - ext/common/ApplicationPool2/Group/InitializationAndShutdown.cpp
2457
+ - ext/common/ApplicationPool2/Group/InternalUtils.cpp
2458
+ - ext/common/ApplicationPool2/Group/LifetimeAndBasics.cpp
2459
+ - ext/common/ApplicationPool2/Group/Miscellaneous.cpp
2460
+ - ext/common/ApplicationPool2/Group/OutOfBandWork.cpp
2461
+ - ext/common/ApplicationPool2/Group/ProcessListManagement.cpp
2462
+ - ext/common/ApplicationPool2/Group/SessionManagement.cpp
2463
+ - ext/common/ApplicationPool2/Group/SpawningAndRestarting.cpp
2464
+ - ext/common/ApplicationPool2/Group/StateInspection.cpp
2465
+ - ext/common/ApplicationPool2/Group/Verification.cpp
2455
2466
  - ext/common/ApplicationPool2/Implementation.cpp
2456
2467
  - ext/common/ApplicationPool2/Options.h
2457
- - ext/common/ApplicationPool2/PipeWatcher.h
2458
2468
  - ext/common/ApplicationPool2/Pool.h
2459
- - ext/common/ApplicationPool2/Pool/AnalyticsCollection.h
2460
- - ext/common/ApplicationPool2/Pool/Debug.h
2461
- - ext/common/ApplicationPool2/Pool/GarbageCollection.h
2462
- - ext/common/ApplicationPool2/Pool/GeneralUtils.h
2463
- - ext/common/ApplicationPool2/Pool/Inspection.h
2464
- - ext/common/ApplicationPool2/Pool/ProcessUtils.h
2469
+ - ext/common/ApplicationPool2/Pool/AnalyticsCollection.cpp
2470
+ - ext/common/ApplicationPool2/Pool/GarbageCollection.cpp
2471
+ - ext/common/ApplicationPool2/Pool/GeneralUtils.cpp
2472
+ - ext/common/ApplicationPool2/Pool/GroupUtils.cpp
2473
+ - ext/common/ApplicationPool2/Pool/InitializationAndShutdown.cpp
2474
+ - ext/common/ApplicationPool2/Pool/Miscellaneous.cpp
2475
+ - ext/common/ApplicationPool2/Pool/ProcessUtils.cpp
2476
+ - ext/common/ApplicationPool2/Pool/StateInspection.cpp
2465
2477
  - ext/common/ApplicationPool2/Process.h
2466
2478
  - ext/common/ApplicationPool2/Session.h
2467
- - ext/common/ApplicationPool2/SmartSpawner.h
2468
2479
  - ext/common/ApplicationPool2/Socket.h
2469
- - ext/common/ApplicationPool2/SpawnObject.h
2470
- - ext/common/ApplicationPool2/Spawner.h
2471
- - ext/common/ApplicationPool2/SpawnerFactory.h
2472
- - ext/common/ApplicationPool2/SuperGroup.h
2473
2480
  - ext/common/BackgroundEventLoop.cpp
2474
2481
  - ext/common/BackgroundEventLoop.h
2475
2482
  - ext/common/Constants.h
@@ -2522,6 +2529,17 @@ files:
2522
2529
  - ext/common/ServerKit/Server.h
2523
2530
  - ext/common/ServerKit/http_parser.cpp
2524
2531
  - ext/common/ServerKit/http_parser.h
2532
+ - ext/common/SpawningKit/BackgroundIOCapturer.h
2533
+ - ext/common/SpawningKit/Config.h
2534
+ - ext/common/SpawningKit/DirectSpawner.h
2535
+ - ext/common/SpawningKit/DummySpawner.h
2536
+ - ext/common/SpawningKit/Factory.h
2537
+ - ext/common/SpawningKit/Options.h
2538
+ - ext/common/SpawningKit/PipeWatcher.h
2539
+ - ext/common/SpawningKit/Result.h
2540
+ - ext/common/SpawningKit/SmartSpawner.h
2541
+ - ext/common/SpawningKit/Spawner.h
2542
+ - ext/common/SpawningKit/UserSwitchingRules.h
2525
2543
  - ext/common/StaticString.h
2526
2544
  - ext/common/UnionStation/Connection.h
2527
2545
  - ext/common/UnionStation/Core.h
@@ -2539,6 +2557,7 @@ files:
2539
2557
  - ext/common/Utils/CachedFileStat.cpp
2540
2558
  - ext/common/Utils/CachedFileStat.h
2541
2559
  - ext/common/Utils/CachedFileStat.hpp
2560
+ - ext/common/Utils/ClassUtils.h
2542
2561
  - ext/common/Utils/Curl.h
2543
2562
  - ext/common/Utils/DateParsing.h
2544
2563
  - ext/common/Utils/Dechunker.h
@@ -2588,9 +2607,10 @@ files:
2588
2607
  - ext/common/Utils/utf8/checked.h
2589
2608
  - ext/common/Utils/utf8/core.h
2590
2609
  - ext/common/Utils/utf8/unchecked.h
2610
+ - ext/common/agents/ApiServerUtils.h
2591
2611
  - ext/common/agents/Base.cpp
2592
2612
  - ext/common/agents/Base.h
2593
- - ext/common/agents/HelperAgent/AdminServer.h
2613
+ - ext/common/agents/HelperAgent/ApiServer.h
2594
2614
  - ext/common/agents/HelperAgent/Main.cpp
2595
2615
  - ext/common/agents/HelperAgent/OptionParser.h
2596
2616
  - ext/common/agents/HelperAgent/RequestHandler.h
@@ -2607,7 +2627,7 @@ files:
2607
2627
  - ext/common/agents/HelperAgent/RequestHandler/Utils.cpp
2608
2628
  - ext/common/agents/HelperAgent/ResponseCache.h
2609
2629
  - ext/common/agents/HelperAgent/SystemMetricsTool.cpp
2610
- - ext/common/agents/LoggingAgent/AdminServer.h
2630
+ - ext/common/agents/LoggingAgent/ApiServer.h
2611
2631
  - ext/common/agents/LoggingAgent/DataStoreId.h
2612
2632
  - ext/common/agents/LoggingAgent/FilterSupport.cpp
2613
2633
  - ext/common/agents/LoggingAgent/FilterSupport.h
@@ -2618,8 +2638,8 @@ files:
2618
2638
  - ext/common/agents/Main.cpp
2619
2639
  - ext/common/agents/SpawnPreparer/Main.cpp
2620
2640
  - ext/common/agents/TempDirToucher/Main.cpp
2621
- - ext/common/agents/Watchdog/AdminServer.h
2622
2641
  - ext/common/agents/Watchdog/AgentWatcher.cpp
2642
+ - ext/common/agents/Watchdog/ApiServer.h
2623
2643
  - ext/common/agents/Watchdog/HelperAgentWatcher.cpp
2624
2644
  - ext/common/agents/Watchdog/InstanceDirToucher.cpp
2625
2645
  - ext/common/agents/Watchdog/LoggingAgentWatcher.cpp
@@ -2812,8 +2832,8 @@ files:
2812
2832
  - lib/phusion_passenger/apache2/config_options.rb
2813
2833
  - lib/phusion_passenger/common_library.rb
2814
2834
  - lib/phusion_passenger/config/about_command.rb
2815
- - lib/phusion_passenger/config/admin_command_command.rb
2816
2835
  - lib/phusion_passenger/config/agent_compiler.rb
2836
+ - lib/phusion_passenger/config/api_call_command.rb
2817
2837
  - lib/phusion_passenger/config/build_native_support_command.rb
2818
2838
  - lib/phusion_passenger/config/command.rb
2819
2839
  - lib/phusion_passenger/config/compile_agent_command.rb
@@ -2920,6 +2940,7 @@ files:
2920
2940
  - resources/templates/apache2/config_snippets.txt.erb
2921
2941
  - resources/templates/apache2/deployment_example.txt.erb
2922
2942
  - resources/templates/apache2/installing_against_a_different_apache.txt.erb
2943
+ - resources/templates/apache2/mpm_unknown.txt.erb
2923
2944
  - resources/templates/apache2/multiple_apache_installations_detected.txt.erb
2924
2945
  - resources/templates/apache2/notify_apache_module_installed.txt.erb
2925
2946
  - resources/templates/apache2/possible_solutions_for_compilation_and_installation_problems.txt.erb
metadata.gz.asc CHANGED
@@ -2,11 +2,11 @@
2
2
  Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
3
3
  Comment: GPGTools - http://gpgtools.org
4
4
 
5
- iQEcBAABAgAGBQJVb0YJAAoJECrHRaUKISqMU68H/17/U+nVV2XKFFF5bYOggw18
6
- RaZYp0wSR3Ny9QJniim+C1ZM/lAsw2kdRJwl3QYtDWZNTG5s8FufFcqiQO9M+V33
7
- 2LhUky32AZo/G+L2obRGE1X3F1MabSKXSl7Qf6pDPzHCt/KkR4QYdN3xyuu1ZaCW
8
- I2shygQS/sOy2k9VYTyhYjsOC2oL6bjDTeiicHd7ma4W6Li0jRlNcaMqZrOCVhH0
9
- XkgSEIowx+YFjTaObOqEJJUBf15W61lp+BVRKHYBy0xoZ+X4rfRGyDKrwboXafue
10
- KbRsmtHqztzpLj/6iF5J5bVzBxhatYe+PZVI6mZfTceILrIYrhsr1PrO+oImbO8=
11
- =wobn
5
+ iQEcBAABAgAGBQJVeH7/AAoJECrHRaUKISqMwvQH/R2rLRW3s0Vmo+kcio2w2r7H
6
+ rgJ+t8rVCL7aItN3ixntLjeSASCzHyy+kyxScX3ByH4z7OCCvaJZRk0C3c1+ecWu
7
+ 1ab9XKvOmxgFtE4R6fd3+47kbOUt1q6h/nV4ucA8lmUy7eP5ArZHfJgu4v+h3AXa
8
+ gsvUtGfmWX75XfURRrfyRuMwgBXLbXcUbyWVSzs8bN4UaNDQaP9Lp7FhcSTMj2mk
9
+ ScGqspf5h/qiYJ9LmHffov8PpJd51TbEGt6ZStvx+R/OMTHMA/ryPBUBhHrL0Njh
10
+ zK7EyTSrf4KCQLOM/8ie1htca4ny5kk+NzCB4VMP+ekMM3p3g2u+gQ9rXynf5Jc=
11
+ =6kLI
12
12
  -----END PGP SIGNATURE-----
@@ -1,127 +0,0 @@
1
- /*
2
- * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2011-2015 Phusion
4
- *
5
- * "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
- *
7
- * Permission is hereby granted, free of charge, to any person obtaining a copy
8
- * of this software and associated documentation files (the "Software"), to deal
9
- * in the Software without restriction, including without limitation the rights
10
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- * copies of the Software, and to permit persons to whom the Software is
12
- * furnished to do so, subject to the following conditions:
13
- *
14
- * The above copyright notice and this permission notice shall be included in
15
- * all copies or substantial portions of the Software.
16
- *
17
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- * THE SOFTWARE.
24
- */
25
-
26
- // This file is included inside the Pool class.
27
-
28
- protected:
29
-
30
- static void runAllActions(const boost::container::vector<Callback> &actions) {
31
- boost::container::vector<Callback>::const_iterator it, end = actions.end();
32
- for (it = actions.begin(); it != end; it++) {
33
- (*it)();
34
- }
35
- }
36
-
37
- static void runAllActionsWithCopy(boost::container::vector<Callback> actions) {
38
- runAllActions(actions);
39
- }
40
-
41
- void verifyInvariants() const {
42
- // !a || b: logical equivalent of a IMPLIES b.
43
- #ifndef NDEBUG
44
- if (!selfchecking) {
45
- return;
46
- }
47
- assert(!( !getWaitlist.empty() ) || ( atFullCapacityUnlocked() ));
48
- assert(!( !atFullCapacityUnlocked() ) || ( getWaitlist.empty() ));
49
- #endif
50
- }
51
-
52
- void verifyExpensiveInvariants() const {
53
- #ifndef NDEBUG
54
- if (!selfchecking) {
55
- return;
56
- }
57
- vector<GetWaiter>::const_iterator it, end = getWaitlist.end();
58
- for (it = getWaitlist.begin(); it != end; it++) {
59
- const GetWaiter &waiter = *it;
60
- const SuperGroupPtr *superGroup;
61
- assert(!superGroups.lookup(waiter.options.getAppGroupName(), &superGroup));
62
- }
63
- #endif
64
- }
65
-
66
- void fullVerifyInvariants() const {
67
- TRACE_POINT();
68
- verifyInvariants();
69
- UPDATE_TRACE_POINT();
70
- verifyExpensiveInvariants();
71
- UPDATE_TRACE_POINT();
72
-
73
- SuperGroupMap::ConstIterator sg_it(superGroups);
74
- while (*sg_it != NULL) {
75
- const SuperGroupPtr &superGroup = sg_it.getValue();
76
- superGroup->verifyInvariants();
77
- foreach (GroupPtr group, superGroup->groups) {
78
- group->verifyInvariants();
79
- group->verifyExpensiveInvariants();
80
- }
81
- sg_it.next();
82
- }
83
- }
84
-
85
- bool runHookScripts(const char *name,
86
- const boost::function<void (HookScriptOptions &)> &setup) const
87
- {
88
- if (agentsOptions != NULL) {
89
- string hookName = string("hook_") + name;
90
- string spec = agentsOptions->get(hookName, false);
91
- if (!spec.empty()) {
92
- HookScriptOptions options;
93
- options.agentsOptions = agentsOptions;
94
- options.name = name;
95
- options.spec = spec;
96
- setup(options);
97
- return Passenger::runHookScripts(options);
98
- } else {
99
- return true;
100
- }
101
- } else {
102
- return true;
103
- }
104
- }
105
-
106
- static const char *maybePluralize(unsigned int count, const char *singular, const char *plural) {
107
- if (count == 1) {
108
- return singular;
109
- } else {
110
- return plural;
111
- }
112
- }
113
-
114
-
115
- public:
116
-
117
- const SpawnerConfigPtr &getSpawnerConfig() const {
118
- return spawnerFactory->getConfig();
119
- }
120
-
121
- const UnionStation::CorePtr &getUnionStationCore() const {
122
- return getSpawnerConfig()->unionStationCore;
123
- }
124
-
125
- const RandomGeneratorPtr &getRandomGenerator() const {
126
- return getSpawnerConfig()->randomGenerator;
127
- }
@@ -1,219 +0,0 @@
1
- /*
2
- * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2011-2015 Phusion
4
- *
5
- * "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
- *
7
- * Permission is hereby granted, free of charge, to any person obtaining a copy
8
- * of this software and associated documentation files (the "Software"), to deal
9
- * in the Software without restriction, including without limitation the rights
10
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- * copies of the Software, and to permit persons to whom the Software is
12
- * furnished to do so, subject to the following conditions:
13
- *
14
- * The above copyright notice and this permission notice shall be included in
15
- * all copies or substantial portions of the Software.
16
- *
17
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- * THE SOFTWARE.
24
- */
25
-
26
- // This file is included inside the Pool class.
27
-
28
- public:
29
-
30
- struct InspectOptions {
31
- bool colorize;
32
- bool verbose;
33
-
34
- InspectOptions()
35
- : colorize(false),
36
- verbose(false)
37
- { }
38
-
39
- InspectOptions(const VariantMap &options)
40
- : colorize(options.getBool("colorize", false, false)),
41
- verbose(options.getBool("verbose", false, false))
42
- { }
43
- };
44
-
45
-
46
- private:
47
-
48
- void inspectProcessList(const InspectOptions &options, stringstream &result,
49
- const Group *group, const ProcessList &processes) const
50
- {
51
- ProcessList::const_iterator p_it;
52
- for (p_it = processes.begin(); p_it != processes.end(); p_it++) {
53
- const ProcessPtr &process = *p_it;
54
- char buf[128];
55
- char cpubuf[10];
56
- char membuf[10];
57
-
58
- if (process->metrics.isValid()) {
59
- snprintf(cpubuf, sizeof(cpubuf), "%d%%", (int) process->metrics.cpu);
60
- snprintf(membuf, sizeof(membuf), "%ldM",
61
- (unsigned long) (process->metrics.realMemory() / 1024));
62
- } else {
63
- snprintf(cpubuf, sizeof(cpubuf), "0%%");
64
- snprintf(membuf, sizeof(membuf), "0M");
65
- }
66
- snprintf(buf, sizeof(buf),
67
- " * PID: %-5lu Sessions: %-2u Processed: %-5u Uptime: %s\n"
68
- " CPU: %-5s Memory : %-5s Last used: %s ago",
69
- (unsigned long) process->pid,
70
- process->sessions,
71
- process->processed,
72
- process->uptime().c_str(),
73
- cpubuf,
74
- membuf,
75
- distanceOfTimeInWords(process->lastUsed / 1000000).c_str());
76
- result << buf << endl;
77
-
78
- if (process->enabled == Process::DISABLING) {
79
- result << " Disabling..." << endl;
80
- } else if (process->enabled == Process::DISABLED) {
81
- result << " DISABLED" << endl;
82
- } else if (process->enabled == Process::DETACHED) {
83
- result << " Shutting down..." << endl;
84
- }
85
-
86
- const Socket *socket;
87
- if (options.verbose && (socket = process->sockets.findSocketWithName("http")) != NULL) {
88
- result << " URL : http://" << replaceString(socket->address, "tcp://", "") << endl;
89
- result << " Password: " << StaticString(group->secret, Group::SECRET_SIZE) << endl;
90
- }
91
- }
92
- }
93
-
94
- static const char *maybeColorize(const InspectOptions &options, const char *color) {
95
- if (options.colorize) {
96
- return color;
97
- } else {
98
- return "";
99
- }
100
- }
101
-
102
-
103
- public:
104
-
105
- string inspect(const InspectOptions &options = InspectOptions(), bool lock = true) const {
106
- DynamicScopedLock l(syncher, lock);
107
- stringstream result;
108
- const char *headerColor = maybeColorize(options, ANSI_COLOR_YELLOW ANSI_COLOR_BLUE_BG ANSI_COLOR_BOLD);
109
- const char *resetColor = maybeColorize(options, ANSI_COLOR_RESET);
110
-
111
- result << headerColor << "----------- General information -----------" << resetColor << endl;
112
- result << "Max pool size : " << max << endl;
113
- result << "Processes : " << getProcessCount(false) << endl;
114
- result << "Requests in top-level queue : " << getWaitlist.size() << endl;
115
- if (options.verbose) {
116
- unsigned int i = 0;
117
- foreach (const GetWaiter &waiter, getWaitlist) {
118
- result << " " << i << ": " << waiter.options.getAppGroupName() << endl;
119
- i++;
120
- }
121
- }
122
- result << endl;
123
-
124
- result << headerColor << "----------- Application groups -----------" << resetColor << endl;
125
- SuperGroupMap::ConstIterator sg_it(superGroups);
126
- while (*sg_it != NULL) {
127
- const SuperGroupPtr &superGroup = sg_it.getValue();
128
- const Group *group = superGroup->defaultGroup;
129
- ProcessList::const_iterator p_it;
130
-
131
- if (group != NULL) {
132
- result << group->name << ":" << endl;
133
- result << " App root: " << group->options.appRoot << endl;
134
- if (group->restarting()) {
135
- result << " (restarting...)" << endl;
136
- }
137
- if (group->spawning()) {
138
- if (group->processesBeingSpawned == 0) {
139
- result << " (spawning...)" << endl;
140
- } else {
141
- result << " (spawning " << group->processesBeingSpawned << " new " <<
142
- maybePluralize(group->processesBeingSpawned, "process", "processes") <<
143
- "...)" << endl;
144
- }
145
- }
146
- result << " Requests in queue: " << group->getWaitlist.size() << endl;
147
- inspectProcessList(options, result, group, group->enabledProcesses);
148
- inspectProcessList(options, result, group, group->disablingProcesses);
149
- inspectProcessList(options, result, group, group->disabledProcesses);
150
- inspectProcessList(options, result, group, group->detachedProcesses);
151
- result << endl;
152
- }
153
- sg_it.next();
154
- }
155
- return result.str();
156
- }
157
-
158
- string toXml(bool includeSecrets = true, bool lock = true) const {
159
- DynamicScopedLock l(syncher, lock);
160
- stringstream result;
161
- SuperGroupMap::ConstIterator sg_it(superGroups);
162
- SuperGroup::GroupList::const_iterator g_it;
163
- ProcessList::const_iterator p_it;
164
-
165
- result << "<?xml version=\"1.0\" encoding=\"iso8859-1\" ?>\n";
166
- result << "<info version=\"3\">";
167
-
168
- result << "<passenger_version>" << PASSENGER_VERSION << "</passenger_version>";
169
- result << "<process_count>" << getProcessCount(false) << "</process_count>";
170
- result << "<max>" << max << "</max>";
171
- result << "<capacity_used>" << capacityUsedUnlocked() << "</capacity_used>";
172
- result << "<get_wait_list_size>" << getWaitlist.size() << "</get_wait_list_size>";
173
-
174
- if (includeSecrets) {
175
- vector<GetWaiter>::const_iterator w_it, w_end = getWaitlist.end();
176
-
177
- result << "<get_wait_list>";
178
- for (w_it = getWaitlist.begin(); w_it != w_end; w_it++) {
179
- const GetWaiter &waiter = *w_it;
180
- result << "<item>";
181
- result << "<app_group_name>" << escapeForXml(waiter.options.getAppGroupName()) << "</app_group_name>";
182
- result << "</item>";
183
- }
184
- result << "</get_wait_list>";
185
- }
186
-
187
- result << "<supergroups>";
188
- while (*sg_it != NULL) {
189
- const SuperGroupPtr &superGroup = sg_it.getValue();
190
-
191
- result << "<supergroup>";
192
- result << "<name>" << escapeForXml(superGroup->name) << "</name>";
193
- result << "<state>" << superGroup->getStateName() << "</state>";
194
- result << "<get_wait_list_size>" << superGroup->getWaitlist.size() << "</get_wait_list_size>";
195
- result << "<capacity_used>" << superGroup->capacityUsed() << "</capacity_used>";
196
- if (includeSecrets) {
197
- result << "<secret>" << escapeForXml(superGroup->secret) << "</secret>";
198
- }
199
-
200
- for (g_it = superGroup->groups.begin(); g_it != superGroup->groups.end(); g_it++) {
201
- const GroupPtr &group = *g_it;
202
-
203
- if (group->componentInfo.isDefault) {
204
- result << "<group default=\"true\">";
205
- } else {
206
- result << "<group>";
207
- }
208
- group->inspectXml(result, includeSecrets);
209
- result << "</group>";
210
- }
211
- result << "</supergroup>";
212
-
213
- sg_it.next();
214
- }
215
- result << "</supergroups>";
216
-
217
- result << "</info>";
218
- return result.str();
219
- }