passenger 5.2.3 → 5.3.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of passenger might be problematic. Click here for more details.

Files changed (241) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +13 -0
  3. data/CONTRIBUTORS +5 -1
  4. data/build/agent.rb +22 -2
  5. data/build/cxx_tests.rb +41 -5
  6. data/build/misc.rb +4 -1
  7. data/build/support/cxx_dependency_map.rb +1746 -908
  8. data/build/support/vendor/cxx_hinted_parser/CxxHintedParser.sublime-project +8 -0
  9. data/build/support/vendor/cxx_hinted_parser/Gemfile +5 -0
  10. data/build/support/vendor/cxx_hinted_parser/Gemfile.lock +30 -0
  11. data/{src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core → build/support/vendor/cxx_hinted_parser}/LICENSE.md +1 -1
  12. data/build/support/vendor/cxx_hinted_parser/README.md +95 -0
  13. data/build/support/vendor/cxx_hinted_parser/Rakefile +4 -0
  14. data/{src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/initialize.rb → build/support/vendor/cxx_hinted_parser/lib/cxx_hinted_parser.rb} +2 -9
  15. data/build/support/vendor/cxx_hinted_parser/lib/cxx_hinted_parser/parser.rb +239 -0
  16. data/dev/ci/README.md +15 -2
  17. data/dev/ci/lib/set-container-envvars.sh +6 -0
  18. data/dev/ci/lib/setup-container.sh +4 -1
  19. data/dev/ci/scripts/debug-console-wrapper.sh +3 -1
  20. data/dev/ci/setup-host +5 -0
  21. data/dev/ci/tests/binaries/Jenkinsfile +105 -0
  22. data/dev/ci/tests/binaries/build-linux +38 -0
  23. data/dev/ci/tests/binaries/build-macos +40 -0
  24. data/dev/ci/tests/binaries/prepare-macos +38 -0
  25. data/dev/ci/tests/binaries/test-linux +45 -0
  26. data/dev/ci/tests/binaries/test-macos +38 -0
  27. data/dev/ci/tests/debian/Jenkinsfile +2 -2
  28. data/dev/ci/tests/rpm/Jenkinsfile +1 -1
  29. data/dev/configkit-schemas/index.json +3 -24
  30. data/dev/vagrant/nginx_rakefile +0 -1
  31. data/package.json +15 -5
  32. data/resources/templates/error_renderer/.editorconfig +19 -0
  33. data/resources/templates/error_renderer/with_details/README.md +9 -0
  34. data/resources/templates/error_renderer/with_details/dist/bundle.js +33 -0
  35. data/resources/templates/error_renderer/with_details/dist/styles.css +17 -0
  36. data/resources/templates/error_renderer/with_details/src/DetailsView.jsx +52 -0
  37. data/resources/templates/error_renderer/with_details/src/GetHelpView.jsx +61 -0
  38. data/resources/templates/error_renderer/with_details/src/JourneyView.css +50 -0
  39. data/resources/templates/error_renderer/with_details/src/JourneyView.jsx +621 -0
  40. data/resources/templates/error_renderer/with_details/src/PageMain.css +114 -0
  41. data/resources/templates/error_renderer/with_details/src/PageMain.jsx +136 -0
  42. data/resources/templates/error_renderer/with_details/src/ProblemDescriptionView.jsx +14 -0
  43. data/resources/templates/error_renderer/with_details/src/ProcessDetailsView.jsx +56 -0
  44. data/resources/templates/error_renderer/with_details/src/SolutionDescriptionView.css +5 -0
  45. data/resources/templates/error_renderer/with_details/src/SolutionDescriptionView.jsx +15 -0
  46. data/resources/templates/error_renderer/with_details/src/SummaryView.jsx +35 -0
  47. data/resources/templates/error_renderer/with_details/src/SystemComponentView.css +34 -0
  48. data/resources/templates/error_renderer/with_details/src/SystemComponentView.jsx +168 -0
  49. data/resources/templates/error_renderer/with_details/src/SystemComponentsView.css +13 -0
  50. data/resources/templates/error_renderer/with_details/src/SystemComponentsView.jsx +116 -0
  51. data/resources/templates/error_renderer/with_details/src/Tab.jsx +12 -0
  52. data/resources/templates/error_renderer/with_details/src/Tabs.jsx +104 -0
  53. data/resources/templates/error_renderer/with_details/src/bootstrap/bootstrap.css +3446 -0
  54. data/resources/templates/error_renderer/with_details/src/bootstrap/bootstrap.js +293 -0
  55. data/resources/templates/error_renderer/with_details/src/bootstrap/config.json +401 -0
  56. data/resources/templates/error_renderer/with_details/src/index.html.template +22 -0
  57. data/resources/templates/error_renderer/with_details/src/index.jsx +23 -0
  58. data/resources/templates/error_renderer/with_details/webpack.config.js +47 -0
  59. data/resources/templates/error_renderer/without_details/dist/bundle.js +1 -0
  60. data/resources/templates/error_renderer/without_details/dist/styles.css +1 -0
  61. data/resources/templates/{undisclosed_error.html.template → error_renderer/without_details/src/index.html.template} +7 -11
  62. data/resources/templates/error_renderer/without_details/src/index.js +1 -0
  63. data/resources/templates/{error_layout.css → error_renderer/without_details/src/main.css} +5 -2
  64. data/resources/templates/error_renderer/without_details/webpack.config.js +42 -0
  65. data/src/agent/AgentMain.cpp +3 -3
  66. data/src/agent/Core/ApplicationPool/BasicProcessInfo.h +13 -0
  67. data/src/agent/Core/ApplicationPool/Common.h +3 -4
  68. data/src/agent/Core/ApplicationPool/Context.h +27 -17
  69. data/src/agent/Core/ApplicationPool/Group.h +3 -1
  70. data/src/agent/Core/ApplicationPool/Group/InitializationAndShutdown.cpp +2 -12
  71. data/src/agent/Core/ApplicationPool/Group/InternalUtils.cpp +55 -10
  72. data/src/agent/Core/ApplicationPool/Group/LifetimeAndBasics.cpp +1 -1
  73. data/src/agent/Core/ApplicationPool/Group/OutOfBandWork.cpp +1 -1
  74. data/src/agent/Core/ApplicationPool/Group/SpawningAndRestarting.cpp +13 -6
  75. data/src/agent/Core/ApplicationPool/Implementation.cpp +16 -100
  76. data/src/agent/Core/ApplicationPool/Options.h +8 -65
  77. data/src/agent/Core/ApplicationPool/Pool.h +4 -21
  78. data/src/agent/Core/ApplicationPool/Pool/AnalyticsCollection.cpp +1 -60
  79. data/src/agent/Core/ApplicationPool/Pool/GeneralUtils.cpp +10 -13
  80. data/src/agent/Core/ApplicationPool/Pool/InitializationAndShutdown.cpp +3 -8
  81. data/src/agent/Core/ApplicationPool/Pool/Miscellaneous.cpp +2 -34
  82. data/src/agent/Core/ApplicationPool/Pool/StateInspection.cpp +1 -1
  83. data/src/agent/Core/ApplicationPool/Process.cpp +17 -12
  84. data/src/agent/Core/ApplicationPool/Process.h +146 -93
  85. data/src/agent/Core/ApplicationPool/Session.h +2 -2
  86. data/src/agent/Core/ApplicationPool/Socket.h +28 -27
  87. data/src/agent/Core/Config.h +1 -3
  88. data/src/agent/Core/ConfigChange.cpp +2 -4
  89. data/src/agent/Core/Controller.h +2 -8
  90. data/src/agent/Core/Controller/BufferBody.cpp +0 -2
  91. data/src/agent/Core/Controller/CheckoutSession.cpp +12 -24
  92. data/src/agent/Core/Controller/Config.h +1 -9
  93. data/src/agent/Core/Controller/ForwardResponse.cpp +0 -34
  94. data/src/agent/Core/Controller/Hooks.cpp +0 -7
  95. data/src/agent/Core/Controller/InitRequest.cpp +0 -43
  96. data/src/agent/Core/Controller/InitializationAndShutdown.cpp +0 -4
  97. data/src/agent/Core/Controller/Request.h +1 -35
  98. data/src/agent/Core/Controller/SendRequest.cpp +0 -32
  99. data/src/agent/Core/CoreMain.cpp +19 -32
  100. data/src/agent/Core/SpawningKit/Config.h +329 -55
  101. data/src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h +369 -0
  102. data/src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h.cxxcodebuilder +307 -0
  103. data/src/agent/Core/SpawningKit/Context.h +211 -0
  104. data/src/agent/Core/SpawningKit/DirectSpawner.h +112 -122
  105. data/src/agent/Core/SpawningKit/DummySpawner.h +59 -20
  106. data/src/agent/Core/SpawningKit/ErrorRenderer.h +117 -0
  107. data/src/agent/Core/SpawningKit/Exceptions.h +1157 -0
  108. data/src/agent/Core/SpawningKit/Factory.h +24 -17
  109. data/src/agent/Core/SpawningKit/{BackgroundIOCapturer.h → Handshake/BackgroundIOCapturer.h} +48 -18
  110. data/src/agent/Core/SpawningKit/Handshake/Perform.h +1650 -0
  111. data/src/agent/Core/SpawningKit/Handshake/Prepare.h +582 -0
  112. data/src/agent/Core/SpawningKit/Handshake/Session.h +91 -0
  113. data/src/agent/Core/SpawningKit/Handshake/WorkDir.h +100 -0
  114. data/src/agent/Core/SpawningKit/Journey.h +561 -0
  115. data/src/agent/Core/SpawningKit/PipeWatcher.h +41 -18
  116. data/src/agent/Core/SpawningKit/README.md +534 -0
  117. data/src/agent/Core/SpawningKit/Result.h +182 -7
  118. data/src/agent/Core/SpawningKit/Result/AutoGeneratedCode.h +69 -0
  119. data/src/agent/Core/SpawningKit/Result/AutoGeneratedCode.h.cxxcodebuilder +110 -0
  120. data/src/agent/Core/SpawningKit/SmartSpawner.h +1027 -562
  121. data/src/agent/Core/SpawningKit/Spawner.h +70 -1134
  122. data/src/agent/Core/SpawningKit/UserSwitchingRules.h +3 -33
  123. data/src/agent/README.md +2 -3
  124. data/src/agent/Shared/ApiServerUtils.h +2 -3
  125. data/src/agent/SpawnEnvSetupper/SpawnEnvSetupperMain.cpp +932 -0
  126. data/src/agent/Watchdog/Config.h +1 -3
  127. data/src/agent/Watchdog/WatchdogMain.cpp +2 -1
  128. data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp +5 -0
  129. data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp +5 -0
  130. data/src/apache2_module/ConfigGeneral/ManifestGeneration.h +22 -13
  131. data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp +5 -0
  132. data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp +3 -0
  133. data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp +13 -0
  134. data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp +7 -0
  135. data/src/apache2_module/DirConfig/AutoGeneratedStruct.h +13 -0
  136. data/src/cxx_supportlib/Constants.h +3 -1
  137. data/src/cxx_supportlib/Exceptions.h +0 -121
  138. data/src/cxx_supportlib/LoggingKit/Implementation.cpp +7 -6
  139. data/src/cxx_supportlib/LoggingKit/Logging.h +3 -1
  140. data/src/cxx_supportlib/Utils.cpp +42 -0
  141. data/src/cxx_supportlib/Utils.h +7 -0
  142. data/src/cxx_supportlib/Utils/IOUtils.cpp +58 -0
  143. data/src/cxx_supportlib/Utils/IOUtils.h +13 -0
  144. data/src/cxx_supportlib/Utils/JsonUtils.h +130 -23
  145. data/src/cxx_supportlib/Utils/ScopeGuard.h +9 -4
  146. data/src/cxx_supportlib/Utils/StrIntUtils.cpp +7 -0
  147. data/src/cxx_supportlib/Utils/StrIntUtils.h +1 -0
  148. data/src/cxx_supportlib/Utils/SystemTime.h +1 -1
  149. data/src/cxx_supportlib/Utils/Timer.h +1 -1
  150. data/src/cxx_supportlib/WebSocketCommandReverseServer.h +6 -4
  151. data/src/cxx_supportlib/vendor-copy/adhoc_lve.h +1 -0
  152. data/src/helper-scripts/node-loader.js +54 -59
  153. data/src/helper-scripts/rack-loader.rb +63 -60
  154. data/src/helper-scripts/rack-preloader.rb +125 -72
  155. data/src/helper-scripts/wsgi-loader.py +100 -43
  156. data/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c +120 -112
  157. data/src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c +15 -8
  158. data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c +142 -142
  159. data/src/nginx_module/ConfigGeneral/ManifestGeneration.c +26 -15
  160. data/src/nginx_module/ConfigGeneral/ManifestGeneration.h +3 -0
  161. data/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c +76 -70
  162. data/src/nginx_module/LocationConfig/AutoGeneratedHeaderSerialization.c +114 -99
  163. data/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c +170 -156
  164. data/src/nginx_module/LocationConfig/AutoGeneratedMergeFunction.c +38 -35
  165. data/src/nginx_module/LocationConfig/AutoGeneratedStruct.h +5 -1
  166. data/src/ruby_supportlib/phusion_passenger.rb +5 -5
  167. data/src/ruby_supportlib/phusion_passenger/admin_tools/instance.rb +14 -1
  168. data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +8 -0
  169. data/src/ruby_supportlib/phusion_passenger/common_library.rb +0 -3
  170. data/src/ruby_supportlib/phusion_passenger/config/nginx_engine_compiler.rb +0 -1
  171. data/src/ruby_supportlib/phusion_passenger/constants.rb +2 -0
  172. data/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb +646 -238
  173. data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +117 -95
  174. data/src/ruby_supportlib/phusion_passenger/packaging.rb +0 -1
  175. data/src/ruby_supportlib/phusion_passenger/platform_info/depcheck_specs/apache2.rb +5 -1
  176. data/src/ruby_supportlib/phusion_passenger/preloader_shared_helpers.rb +92 -69
  177. data/src/ruby_supportlib/phusion_passenger/public_api.rb +0 -17
  178. data/src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb +0 -3
  179. data/src/ruby_supportlib/phusion_passenger/request_handler.rb +4 -5
  180. data/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb +0 -22
  181. metadata +64 -67
  182. data/resources/templates/error_layout.html.template +0 -86
  183. data/resources/templates/general_error.html.template +0 -1
  184. data/resources/templates/general_error_with_html.html.template +0 -1
  185. data/src/agent/Core/ApplicationPool/ErrorRenderer.h +0 -131
  186. data/src/agent/Core/SpawningKit/Options.h +0 -41
  187. data/src/agent/Core/UnionStation/Connection.h +0 -173
  188. data/src/agent/Core/UnionStation/Context.h +0 -536
  189. data/src/agent/Core/UnionStation/StopwatchLog.h +0 -147
  190. data/src/agent/Core/UnionStation/Transaction.h +0 -249
  191. data/src/agent/SpawnPreparer/SpawnPreparerMain.cpp +0 -208
  192. data/src/cxx_supportlib/UnionStationFilterSupport.cpp +0 -67
  193. data/src/cxx_supportlib/UnionStationFilterSupport.h +0 -1622
  194. data/src/nodejs_supportlib/phusion_passenger/log_express.js +0 -106
  195. data/src/nodejs_supportlib/phusion_passenger/log_mongodb.js +0 -202
  196. data/src/nodejs_supportlib/phusion_passenger/ustreporter.js +0 -227
  197. data/src/nodejs_supportlib/phusion_passenger/ustrouter_connector.js +0 -448
  198. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/CONFIG.md +0 -37
  199. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/Gemfile +0 -17
  200. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/Gemfile.lock +0 -59
  201. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/README-API.md +0 -5
  202. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/README.md +0 -117
  203. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/Rakefile +0 -115
  204. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core.rb +0 -423
  205. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/api.rb +0 -238
  206. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/connection.rb +0 -67
  207. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/context.rb +0 -281
  208. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/lock.rb +0 -62
  209. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/log.rb +0 -66
  210. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/message_channel.rb +0 -157
  211. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter.rb +0 -150
  212. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/basics.rb +0 -199
  213. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/controllers.rb +0 -187
  214. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/misc.rb +0 -303
  215. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/view_rendering.rb +0 -91
  216. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/simple_json.rb +0 -396
  217. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/spec_helper.rb +0 -279
  218. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/time_point.rb +0 -39
  219. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/transaction.rb +0 -173
  220. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/utils.rb +0 -177
  221. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/version.rb +0 -32
  222. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/version_data.rb +0 -44
  223. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.example +0 -16
  224. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.travis +0 -20
  225. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.travis-with-sudo +0 -18
  226. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/union_station_hooks_core.gemspec +0 -23
  227. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Gemfile +0 -14
  228. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Gemfile.lock +0 -45
  229. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/LICENSE.md +0 -19
  230. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/README.md +0 -104
  231. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Rakefile +0 -160
  232. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails.rb +0 -200
  233. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/action_controller_extension.rb +0 -45
  234. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/action_view_subscriber.rb +0 -55
  235. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/active_record_subscriber.rb +0 -41
  236. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/active_support_benchmarkable_extension.rb +0 -47
  237. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/active_support_cache_subscriber.rb +0 -79
  238. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/exception_logger.rb +0 -57
  239. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/version.rb +0 -32
  240. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/version_data.rb +0 -44
  241. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/union_station_hooks_rails.gemspec +0 -34
@@ -105,47 +105,6 @@ Pool::updateProcessMetrics(const ProcessList &processes,
105
105
  }
106
106
  }
107
107
 
108
- void
109
- Pool::prepareUnionStationProcessStateLogs(vector<UnionStationLogEntry> &logEntries,
110
- const GroupPtr &group) const
111
- {
112
- const UnionStation::ContextPtr &unionStationContext = getUnionStationContext();
113
- if (group->options.analytics && unionStationContext != NULL) {
114
- logEntries.push_back(UnionStationLogEntry());
115
- UnionStationLogEntry &entry = logEntries.back();
116
- stringstream stream;
117
-
118
- stream << "Group: <group>";
119
- group->inspectXml(stream, false);
120
- stream << "</group>";
121
-
122
- entry.groupName = group->options.getAppGroupName();
123
- entry.category = "processes";
124
- entry.key = group->options.unionStationKey;
125
- entry.data = stream.str();
126
- }
127
- }
128
-
129
- void
130
- Pool::prepareUnionStationSystemMetricsLogs(vector<UnionStationLogEntry> &logEntries,
131
- const GroupPtr &group) const
132
- {
133
- const UnionStation::ContextPtr &unionStationContext = getUnionStationContext();
134
- if (group->options.analytics && unionStationContext != NULL) {
135
- logEntries.push_back(UnionStationLogEntry());
136
- UnionStationLogEntry &entry = logEntries.back();
137
- stringstream stream;
138
-
139
- stream << "System metrics: ";
140
- systemMetrics.toXml(stream);
141
-
142
- entry.groupName = group->options.getAppGroupName();
143
- entry.category = "system_metrics";
144
- entry.key = group->options.unionStationKey;
145
- entry.data = stream.str();
146
- }
147
- }
148
-
149
108
  void
150
109
  Pool::realCollectAnalytics() {
151
110
  TRACE_POINT();
@@ -177,7 +136,7 @@ Pool::realCollectAnalytics() {
177
136
  }
178
137
 
179
138
  // Collect process metrics and system and store them in the
180
- // data structures. Later, we log them to Union Station.
139
+ // data structures.
181
140
  ProcessMetricMap processMetrics;
182
141
  try {
183
142
  UPDATE_TRACE_POINT();
@@ -198,7 +157,6 @@ Pool::realCollectAnalytics() {
198
157
 
199
158
  {
200
159
  UPDATE_TRACE_POINT();
201
- vector<UnionStationLogEntry> logEntries;
202
160
  vector<ProcessPtr> processesToDetach;
203
161
  boost::container::vector<Callback> actions;
204
162
  ScopedLock l(syncher);
@@ -210,8 +168,6 @@ Pool::realCollectAnalytics() {
210
168
  updateProcessMetrics(group->enabledProcesses, processMetrics, processesToDetach);
211
169
  updateProcessMetrics(group->disablingProcesses, processMetrics, processesToDetach);
212
170
  updateProcessMetrics(group->disabledProcesses, processMetrics, processesToDetach);
213
- prepareUnionStationProcessStateLogs(logEntries, group);
214
- prepareUnionStationSystemMetricsLogs(logEntries, group);
215
171
  g_it.next();
216
172
  }
217
173
 
@@ -223,21 +179,6 @@ Pool::realCollectAnalytics() {
223
179
  processesToDetach.clear();
224
180
 
225
181
  l.unlock();
226
- UPDATE_TRACE_POINT();
227
- if (!logEntries.empty()) {
228
- const UnionStation::ContextPtr &unionStationContext = getUnionStationContext();
229
- P_DEBUG("Sending process and system metrics to Union Station");
230
- while (!logEntries.empty()) {
231
- UnionStationLogEntry &entry = logEntries.back();
232
- UnionStation::TransactionPtr transaction =
233
- unionStationContext->newTransaction(
234
- entry.groupName,
235
- entry.category,
236
- entry.key);
237
- transaction->message(entry.data);
238
- logEntries.pop_back();
239
- }
240
- }
241
182
 
242
183
  UPDATE_TRACE_POINT();
243
184
  runAllActions(actions);
@@ -80,12 +80,14 @@ bool
80
80
  Pool::runHookScripts(const char *name,
81
81
  const boost::function<void (HookScriptOptions &)> &setup) const
82
82
  {
83
- if (!agentConfig.isNull()) {
83
+ ScopedLock l(context->agentConfigSyncher);
84
+ if (!context->agentConfig.isNull()) {
84
85
  string hookName = string("hook_") + name;
85
- string spec = agentConfig.get(hookName, Json::Value()).asString();
86
+ string spec = context->agentConfig.get(hookName, Json::Value()).asString();
86
87
  if (!spec.empty()) {
87
88
  HookScriptOptions options;
88
- options.agentConfig = agentConfig;
89
+ options.agentConfig = context->agentConfig;
90
+ l.unlock();
89
91
  options.name = name;
90
92
  options.spec = spec;
91
93
  setup(options);
@@ -219,22 +221,17 @@ Pool::syncGetCallback(const AbstractSessionPtr &session, const ExceptionPtr &e,
219
221
 
220
222
  Context *
221
223
  Pool::getContext() {
222
- return &context;
224
+ return context;
223
225
  }
224
226
 
225
- const SpawningKit::ConfigPtr &
226
- Pool::getSpawningKitConfig() const {
227
- return context.getSpawningKitConfig();
228
- }
229
-
230
- const UnionStation::ContextPtr &
231
- Pool::getUnionStationContext() const {
232
- return getSpawningKitConfig()->unionStationContext;
227
+ SpawningKit::Context *
228
+ Pool::getSpawningKitContext() const {
229
+ return context->getSpawningKitContext();
233
230
  }
234
231
 
235
232
  const RandomGeneratorPtr &
236
233
  Pool::getRandomGenerator() const {
237
- return getSpawningKitConfig()->randomGenerator;
234
+ return context->getRandomGenerator();
238
235
  }
239
236
 
240
237
 
@@ -38,15 +38,10 @@ using namespace std;
38
38
  using namespace boost;
39
39
 
40
40
 
41
- Pool::Pool(const SpawningKit::FactoryPtr &spawningKitFactory,
42
- const Json::Value &agentConfig)
43
- : abortLongRunningConnectionsCallback(NULL)
41
+ Pool::Pool(Context *_context)
42
+ : context(_context),
43
+ abortLongRunningConnectionsCallback(NULL)
44
44
  {
45
- context.setSpawningKitFactory(spawningKitFactory);
46
- context.finalize();
47
-
48
- this->agentConfig = agentConfig;
49
-
50
45
  try {
51
46
  systemMetricsCollector.collect(systemMetrics);
52
47
  } catch (const RuntimeException &e) {
@@ -41,7 +41,7 @@ using namespace boost;
41
41
  // 'lockNow == false' may only be used during unit tests. Normally we
42
42
  // should never call the callback while holding the lock.
43
43
  void
44
- Pool::asyncGet(const Options &options, const GetCallback &callback, bool lockNow, UnionStation::StopwatchLog **stopwatchLog) {
44
+ Pool::asyncGet(const Options &options, const GetCallback &callback, bool lockNow) {
45
45
  DynamicScopedLock lock(syncher, lockNow);
46
46
 
47
47
  assert(lifeStatus == ALIVE || lifeStatus == PREPARED_FOR_SHUTDOWN);
@@ -50,32 +50,6 @@ Pool::asyncGet(const Options &options, const GetCallback &callback, bool lockNow
50
50
  boost::container::vector<Callback> actions;
51
51
 
52
52
  Group *existingGroup = findMatchingGroup(options);
53
- if (stopwatchLog != NULL) {
54
- // Log some essentials stats about what this request is facing in its upcoming journey through the queue:
55
- // 1) position in the queue upon entry, and 2) whether spawning activity is occurring (which takes cycles
56
- // but also indicates the server has headroom to handle the load).
57
- Json::Value data;
58
- if (!existingGroup) {
59
- data["message"] = "spawning.."; // the first of this group, so keep it simple (also: we don't know maxQ yet)
60
- } else {
61
- char queueMaxStr[10];
62
- int queueMax = existingGroup->options.maxRequestQueueSize;
63
- if (queueMax > 0) {
64
- snprintf(queueMaxStr, sizeof(queueMaxStr), "%d", queueMax);
65
- }
66
- char message[50];
67
- snprintf(message, sizeof(message), "queue: %zu / %s, spawning: %s", existingGroup->getWaitlist.size(),
68
- (queueMax == 0 ? "inf" : queueMaxStr),
69
- (existingGroup->processesBeingSpawned == 0 ? "no" : "yes"));
70
- data["message"] = message;
71
- }
72
- Json::Value json;
73
- json["data"] = data;
74
- json["data_type"] = "generic";
75
- json["name"] = "Await available process";
76
-
77
- *stopwatchLog = new UnionStation::StopwatchLog(options.transaction, "Pool::asyncGet", stringifyJson(json).c_str());
78
- }
79
53
 
80
54
  if (OXT_LIKELY(existingGroup != NULL)) {
81
55
  /* Best case: the app group is already in the pool. Let's use it. */
@@ -119,7 +93,7 @@ Pool::asyncGet(const Options &options, const GetCallback &callback, bool lockNow
119
93
  */
120
94
  P_DEBUG("Could not free a process; putting request to top-level getWaitlist");
121
95
  getWaitlist.push_back(GetWaiter(
122
- options.copyAndPersist().detachFromUnionStationTransaction(),
96
+ options.copyAndPersist(),
123
97
  callback));
124
98
  } else {
125
99
  /* Now that a process has been trashed we can create
@@ -250,12 +224,6 @@ Pool::isSpawning(bool lock) const {
250
224
  return false;
251
225
  }
252
226
 
253
- void
254
- Pool::setAgentConfig(const Json::Value &agentConfig) {
255
- LockGuard l(syncher);
256
- this->agentConfig = agentConfig;
257
- }
258
-
259
227
  bool
260
228
  Pool::authorizeByApiKey(const ApiKey &key, bool lock) const {
261
229
  return key.isSuper() || findGroupByApiKey(key.toStaticString(), lock) != NULL;
@@ -108,7 +108,7 @@ Pool::inspectProcessList(const InspectOptions &options, stringstream &result,
108
108
  }
109
109
 
110
110
  const Socket *socket;
111
- if (options.verbose && (socket = process->getSockets().findSocketWithName("http")) != NULL) {
111
+ if (options.verbose && (socket = process->getSockets().findFirstSocketWithProtocol("http")) != NULL) {
112
112
  result << " URL : http://" << replaceString(socket->address, "tcp://", "") << endl;
113
113
  result << " Password: " << group->getApiKey().toStaticString() << endl;
114
114
  }
@@ -33,20 +33,25 @@ namespace ApplicationPool2 {
33
33
  using namespace std;
34
34
  using namespace boost;
35
35
 
36
- SpawningKit::PipeWatcherPtr Process::makePipeWatcher(const SpawningKit::ConfigPtr &config, FileDescriptor socket, const char *channel, pid_t pid, const BasicGroupInfo *groupInfo) {
37
- StaticString appLogFile;
38
- HashedStaticString appGroupName;
39
- if (groupInfo->group != NULL) {
40
- appLogFile = groupInfo->group->options.appLogFile;
41
- appGroupName = groupInfo->group->options.getAppGroupName();
36
+
37
+ string
38
+ Process::getAppGroupName(const BasicGroupInfo *info) const {
39
+ if (info->group != NULL) {
40
+ return info->group->options.getAppGroupName().toString();
41
+ } else {
42
+ return string();
42
43
  }
43
- SpawningKit::PipeWatcherPtr watcher = boost::make_shared<SpawningKit::PipeWatcher>(
44
- config, socket, channel, pid, appGroupName, appLogFile
45
- );
46
- watcher->initialize();
47
- watcher->start();
48
- return watcher;
49
44
  }
50
45
 
46
+ string
47
+ Process::getAppLogFile(const BasicGroupInfo *info) const {
48
+ if (info->group != NULL) {
49
+ return info->group->options.appLogFile.toString();
50
+ } else {
51
+ return string();
52
+ }
53
+ }
54
+
55
+
51
56
  } // namespace ApplicationPool2
52
57
  } // namespace Passenger
@@ -65,16 +65,14 @@ typedef boost::container::vector<ProcessPtr> ProcessList;
65
65
 
66
66
  /**
67
67
  * Represents an application process, as spawned by a SpawningKit::Spawner. Every
68
- * Process has a PID, an admin socket and a list of sockets on which it listens for
69
- * connections. A Process object is contained inside a Group.
68
+ * Process has a PID, a stdin pipe, an output pipe and a list of sockets on which
69
+ * it listens for connections. A Process object is contained inside a Group.
70
70
  *
71
- * The admin socket, an anonymous Unix domain socket, is mapped to the process's
72
- * STDIN and STDOUT and has two functions.
71
+ * The stdin pipe is mapped to the process's STDIN and is used for garbage
72
+ * collection: closing the STDIN part causes the process to gracefully terminate itself.
73
73
  *
74
- * 1. It acts as the main communication channel with the process. Commands are
75
- * sent to and responses are received from it.
76
- * 2. It's used for garbage collection: closing the STDIN part causes the process
77
- * to gracefully terminate itself.
74
+ * The output pipe is mapped to the process' STDOUT and STDERR. All data coming
75
+ * from those pipes will be printed.
78
76
  *
79
77
  * Except for the otherwise documented parts, this class is not thread-safe,
80
78
  * so only use within the Pool lock.
@@ -102,7 +100,7 @@ typedef boost::container::vector<ProcessPtr> ProcessList;
102
100
  */
103
101
  class Process {
104
102
  public:
105
- static const unsigned int MAX_SESSION_SOCKETS = 3;
103
+ static const unsigned int MAX_SOCKETS_ACCEPTING_HTTP_REQUESTS = 3;
106
104
 
107
105
  private:
108
106
  /*************************************************************
@@ -121,21 +119,20 @@ private:
121
119
  int concurrency;
122
120
 
123
121
  /**
124
- * A subset of 'sockets': all sockets that speak the
125
- * "session" or "http_session" protocol.
122
+ * A subset of 'sockets': all sockets that accept HTTP requests
123
+ * from the Passenger Core controller.
126
124
  */
127
- unsigned int sessionSocketCount;
128
- Socket *sessionSockets[MAX_SESSION_SOCKETS];
125
+ unsigned int socketsAcceptingHttpRequestsCount;
126
+ Socket *socketsAcceptingHttpRequests[MAX_SOCKETS_ACCEPTING_HTTP_REQUESTS];
129
127
 
130
- /** Admin socket. See Process class description. */
131
- FileDescriptor adminSocket;
128
+ /** Input pipe. See Process class description. */
129
+ FileDescriptor inputPipe;
132
130
 
133
131
  /**
134
- * Pipe on which this process outputs errors. Mapped to the process's STDERR.
135
- * Only Processes spawned by DirectSpawner have this set.
136
- * SmartSpawner-spawned Processes use the same STDERR as their parent preloader processes.
132
+ * Pipe on which this process outputs stdout and stderr data. Mapped to the
133
+ * process's STDOUT and STDERR.
137
134
  */
138
- FileDescriptor errorPipe;
135
+ FileDescriptor outputPipe;
139
136
 
140
137
  /**
141
138
  * The code revision of the application, inferred through various means.
@@ -201,9 +198,9 @@ private:
201
198
  };
202
199
 
203
200
  struct SocketStringOffsets {
204
- String name;
205
201
  String address;
206
202
  String protocol;
203
+ String description;
207
204
  };
208
205
 
209
206
  vector<SocketStringOffsets> socketStringOffsets;
@@ -211,15 +208,33 @@ private:
211
208
  };
212
209
 
213
210
  void appendJsonFieldToBuffer(std::string &buffer, const Json::Value &json,
214
- const char *key, InitializationLog::String &str) const
211
+ const char *key, InitializationLog::String &str, bool required = true) const
215
212
  {
216
- StaticString value = getJsonStaticStringField(json, key);
213
+ StaticString value;
214
+ if (required) {
215
+ value = getJsonStaticStringField(json, key);
216
+ } else {
217
+ value = getJsonStaticStringField(json, Json::StaticString(key),
218
+ StaticString());
219
+ }
217
220
  str.offset = buffer.size();
218
221
  str.size = value.size();
219
222
  buffer.append(value.data(), value.size());
220
223
  buffer.append(1, '\0');
221
224
  }
222
225
 
226
+ void initializeSocketsAndStringFields(const SpawningKit::Result &result) {
227
+ Json::Value doc, sockets(Json::arrayValue);
228
+ vector<SpawningKit::Result::Socket>::const_iterator it, end = result.sockets.end();
229
+
230
+ for (it = result.sockets.begin(); it != end; it++) {
231
+ sockets.append(it->inspectAsJson());
232
+ }
233
+
234
+ doc["sockets"] = sockets;
235
+ initializeSocketsAndStringFields(doc);
236
+ }
237
+
223
238
  void initializeSocketsAndStringFields(const Json::Value &json) {
224
239
  InitializationLog log;
225
240
  string buffer;
@@ -238,9 +253,10 @@ private:
238
253
  const Json::Value &socket = *it;
239
254
  InitializationLog::SocketStringOffsets offsets;
240
255
 
241
- appendJsonFieldToBuffer(buffer, socket, "name", offsets.name);
242
256
  appendJsonFieldToBuffer(buffer, socket, "address", offsets.address);
243
257
  appendJsonFieldToBuffer(buffer, socket, "protocol", offsets.protocol);
258
+ appendJsonFieldToBuffer(buffer, socket, "description", offsets.description,
259
+ false);
244
260
 
245
261
  log.socketStringOffsets.push_back(offsets);
246
262
  }
@@ -267,13 +283,14 @@ private:
267
283
  const Json::Value &socket = *it;
268
284
  this->sockets.add(
269
285
  info.pid,
270
- StaticString(base + log.socketStringOffsets[i].name.offset,
271
- log.socketStringOffsets[i].name.size),
272
286
  StaticString(base + log.socketStringOffsets[i].address.offset,
273
287
  log.socketStringOffsets[i].address.size),
274
288
  StaticString(base + log.socketStringOffsets[i].protocol.offset,
275
289
  log.socketStringOffsets[i].protocol.size),
276
- getJsonIntField(socket, "concurrency")
290
+ StaticString(base + log.socketStringOffsets[i].description.offset,
291
+ log.socketStringOffsets[i].description.size),
292
+ getJsonIntField(socket, "concurrency"),
293
+ getJsonBoolField(socket, "accept_http_requests")
277
294
  );
278
295
  }
279
296
 
@@ -283,44 +300,51 @@ private:
283
300
  }
284
301
  }
285
302
 
286
- void indexSessionSockets() {
303
+ void indexSocketsAcceptingHttpRequests() {
287
304
  SocketList::iterator it;
288
305
 
289
306
  concurrency = 0;
290
- memset(sessionSockets, 0, sizeof(sessionSockets));
307
+ memset(socketsAcceptingHttpRequests, 0, sizeof(socketsAcceptingHttpRequests));
291
308
 
292
309
  for (it = sockets.begin(); it != sockets.end(); it++) {
293
310
  Socket *socket = &(*it);
294
- if (socket->protocol == "session" || socket->protocol == "http_session") {
295
- if (sessionSocketCount == MAX_SESSION_SOCKETS) {
296
- throw RuntimeException("The process has too many session sockets. "
297
- "A maximum of " + toString(MAX_SESSION_SOCKETS) + " is allowed");
298
- }
299
- sessionSockets[sessionSocketCount] = socket;
300
- sessionSocketCount++;
301
-
302
- if (concurrency != -1) {
303
- if (socket->concurrency == 0) {
304
- // If one of the sockets has a concurrency of
305
- // 0 (unlimited) then we mark this entire Process
306
- // as having a concurrency of 0.
307
- concurrency = -1;
308
- } else {
309
- concurrency += socket->concurrency;
310
- }
311
+ if (!socket->acceptHttpRequests) {
312
+ continue;
313
+ }
314
+ if (socketsAcceptingHttpRequestsCount == MAX_SOCKETS_ACCEPTING_HTTP_REQUESTS) {
315
+ throw RuntimeException("The process has too many sockets that accept HTTP requests. "
316
+ "A maximum of " + toString(MAX_SOCKETS_ACCEPTING_HTTP_REQUESTS) + " is allowed");
317
+ }
318
+
319
+ socketsAcceptingHttpRequests[socketsAcceptingHttpRequestsCount] = socket;
320
+ socketsAcceptingHttpRequestsCount++;
321
+
322
+ if (concurrency >= 0) {
323
+ if (socket->concurrency < 0) {
324
+ // If one of the sockets has a concurrency of
325
+ // < 0 (unknown) then we mark this entire Process
326
+ // as having a concurrency of -1 (unknown).
327
+ concurrency = -1;
328
+ } else if (socket->concurrency == 0) {
329
+ // If one of the sockets has a concurrency of
330
+ // 0 (unlimited) then we mark this entire Process
331
+ // as having a concurrency of 0.
332
+ concurrency = -999;
333
+ } else {
334
+ concurrency += socket->concurrency;
311
335
  }
312
336
  }
313
337
  }
314
338
 
315
- if (concurrency == -1) {
339
+ if (concurrency == -999) {
316
340
  concurrency = 0;
317
341
  }
318
342
  }
319
343
 
320
344
  void destroySelf() const {
321
345
  this->~Process();
322
- LockGuard l(getContext()->getMmSyncher());
323
- getContext()->getProcessObjectPool().free(const_cast<Process *>(this));
346
+ LockGuard l(getContext()->memoryManagementSyncher);
347
+ getContext()->processObjectPool.free(const_cast<Process *>(this));
324
348
  }
325
349
 
326
350
 
@@ -353,7 +377,8 @@ private:
353
377
  return result;
354
378
  }
355
379
 
356
- SpawningKit::PipeWatcherPtr makePipeWatcher(const SpawningKit::ConfigPtr &config, FileDescriptor socket, const char *channel, pid_t pid, const BasicGroupInfo *groupInfo);
380
+ string getAppGroupName(const BasicGroupInfo *info) const;
381
+ string getAppLogFile(const BasicGroupInfo *info) const;
357
382
 
358
383
  public:
359
384
  /*************************************************************
@@ -427,13 +452,13 @@ public:
427
452
  ProcessMetrics metrics;
428
453
 
429
454
 
430
- Process(const BasicGroupInfo *groupInfo, const Json::Value &json)
431
- : info(this, groupInfo, json),
432
- sessionSocketCount(0),
433
- spawnerCreationTime(getJsonUint64Field(json, "spawner_creation_time")),
434
- spawnStartTime(getJsonUint64Field(json, "spawn_start_time")),
455
+ Process(const BasicGroupInfo *groupInfo, const Json::Value &args)
456
+ : info(this, groupInfo, args),
457
+ socketsAcceptingHttpRequestsCount(0),
458
+ spawnerCreationTime(getJsonUint64Field(args, "spawner_creation_time")),
459
+ spawnStartTime(getJsonUint64Field(args, "spawn_start_time")),
435
460
  spawnEndTime(SystemTime::getUsec()),
436
- dummy(json["type"] == "dummy"),
461
+ dummy(args["type"] == "dummy"),
437
462
  requiresShutdown(false),
438
463
  refcount(1),
439
464
  index(-1),
@@ -447,21 +472,46 @@ public:
447
472
  longRunningConnectionsAborted(false),
448
473
  shutdownStartTime(0)
449
474
  {
450
- initializeSocketsAndStringFields(json);
451
- indexSessionSockets();
452
-
453
- const SpawningKit::Result *skResult = dynamic_cast<const SpawningKit::Result *>(&json);
454
- if (skResult != NULL) {
455
- adminSocket = skResult->adminSocket;
456
- errorPipe = skResult->errorPipe;
457
-
458
- if (adminSocket != -1) {
459
- SpawningKit::PipeWatcherPtr watcher = makePipeWatcher(getContext()->getSpawningKitConfig(), adminSocket, "stdout", info.pid, groupInfo);
460
- }
461
-
462
- if (errorPipe != -1) {
463
- SpawningKit::PipeWatcherPtr watcher = makePipeWatcher(getContext()->getSpawningKitConfig(), errorPipe, "stderr", info.pid, groupInfo);
475
+ initializeSocketsAndStringFields(args);
476
+ indexSocketsAcceptingHttpRequests();
477
+ }
478
+
479
+ Process(const BasicGroupInfo *groupInfo, const SpawningKit::Result &skResult,
480
+ const Json::Value &args)
481
+ : info(this, groupInfo, skResult),
482
+ socketsAcceptingHttpRequestsCount(0),
483
+ spawnerCreationTime(getJsonUint64Field(args, "spawner_creation_time")),
484
+ spawnStartTime(skResult.spawnStartTime),
485
+ spawnEndTime(skResult.spawnEndTime),
486
+ dummy(skResult.dummy),
487
+ requiresShutdown(false),
488
+ refcount(1),
489
+ index(-1),
490
+ lastUsed(spawnEndTime),
491
+ sessions(0),
492
+ processed(0),
493
+ lifeStatus(ALIVE),
494
+ enabled(ENABLED),
495
+ oobwStatus(OOBW_NOT_ACTIVE),
496
+ m_osProcessExists(true),
497
+ longRunningConnectionsAborted(false),
498
+ shutdownStartTime(0)
499
+ {
500
+ initializeSocketsAndStringFields(skResult);
501
+ indexSocketsAcceptingHttpRequests();
502
+
503
+ inputPipe = skResult.stdinFd;
504
+ outputPipe = skResult.stdoutAndErrFd;
505
+
506
+ if (outputPipe != -1) {
507
+ SpawningKit::PipeWatcherPtr watcher = boost::make_shared<SpawningKit::PipeWatcher>(
508
+ outputPipe, "output", getAppGroupName(groupInfo),
509
+ getAppLogFile(groupInfo), skResult.pid);
510
+ if (!args["log_file"].isNull()) {
511
+ watcher->setLogFile(args["log_file"].asString());
464
512
  }
513
+ watcher->initialize();
514
+ watcher->start();
465
515
  }
466
516
  }
467
517
 
@@ -479,8 +529,8 @@ public:
479
529
  void forceMaxConcurrency(int value) {
480
530
  assert(value >= 0);
481
531
  concurrency = value;
482
- for (unsigned i = 0; i < sessionSocketCount; i++) {
483
- sessionSockets[i]->concurrency = concurrency;
532
+ for (unsigned i = 0; i < socketsAcceptingHttpRequestsCount; i++) {
533
+ socketsAcceptingHttpRequests[i]->concurrency = concurrency;
484
534
  }
485
535
  }
486
536
 
@@ -553,8 +603,8 @@ public:
553
603
  lifeStatus = SHUTDOWN_TRIGGERED;
554
604
  shutdownStartTime = now;
555
605
  }
556
- if (!dummy) {
557
- syscalls::shutdown(adminSocket, SHUT_WR);
606
+ if (inputPipe != -1) {
607
+ inputPipe.close();
558
608
  }
559
609
  }
560
610
 
@@ -644,23 +694,23 @@ public:
644
694
  return sockets;
645
695
  }
646
696
 
647
- Socket *findSessionSocketWithLowestBusyness() const {
648
- if (OXT_UNLIKELY(sessionSocketCount == 0)) {
697
+ Socket *findSocketsAcceptingHttpRequestsAndWithLowestBusyness() const {
698
+ if (OXT_UNLIKELY(socketsAcceptingHttpRequestsCount == 0)) {
649
699
  return NULL;
650
- } else if (sessionSocketCount == 1) {
651
- return sessionSockets[0];
700
+ } else if (socketsAcceptingHttpRequestsCount == 1) {
701
+ return socketsAcceptingHttpRequests[0];
652
702
  } else {
653
- int leastBusySessionSocketIndex = 0;
654
- int lowestBusyness = sessionSockets[0]->busyness();
703
+ int leastBusySocketIndex = 0;
704
+ int lowestBusyness = socketsAcceptingHttpRequests[0]->busyness();
655
705
 
656
- for (unsigned i = 1; i < sessionSocketCount; i++) {
657
- if (sessionSockets[i]->busyness() < lowestBusyness) {
658
- leastBusySessionSocketIndex = i;
659
- lowestBusyness = sessionSockets[i]->busyness();
706
+ for (unsigned i = 1; i < socketsAcceptingHttpRequestsCount; i++) {
707
+ if (socketsAcceptingHttpRequests[i]->busyness() < lowestBusyness) {
708
+ leastBusySocketIndex = i;
709
+ lowestBusyness = socketsAcceptingHttpRequests[i]->busyness();
660
710
  }
661
711
  }
662
712
 
663
- return sessionSockets[leastBusySessionSocketIndex];
713
+ return socketsAcceptingHttpRequests[leastBusySocketIndex];
664
714
  }
665
715
  }
666
716
 
@@ -700,15 +750,15 @@ public:
700
750
  /* Different processes within a Group may have different
701
751
  * 'concurrency' values. We want:
702
752
  * - the process with the smallest busyness to be be picked for routing.
703
- * - to give processes with concurrency == 0 more priority (in general)
753
+ * - to give processes with concurrency == 0 or -1 more priority (in general)
704
754
  * over processes with concurrency > 0.
705
755
  * Therefore, in case of processes with concurrency > 0, we describe our
706
756
  * busyness as a percentage of 'concurrency', with the percentage value
707
757
  * in [0..INT_MAX] instead of [0..1]. That way, the busyness value
708
758
  * of processes with concurrency > 0 is usually higher than that of processes
709
- * with concurrency == 0.
759
+ * with concurrency == 0 or -1.
710
760
  */
711
- if (concurrency == 0) {
761
+ if (concurrency <= 0) {
712
762
  return sessions;
713
763
  } else {
714
764
  return (int) (((long long) sessions * INT_MAX) / (double) concurrency);
@@ -720,7 +770,7 @@ public:
720
770
  * process.
721
771
  */
722
772
  bool isTotallyBusy() const {
723
- return concurrency != 0 && sessions >= concurrency;
773
+ return concurrency > 0 && sessions >= concurrency;
724
774
  }
725
775
 
726
776
  /**
@@ -745,7 +795,7 @@ public:
745
795
  * not result in any harmful behavior.
746
796
  */
747
797
  SessionPtr newSession(unsigned long long now = 0) {
748
- Socket *socket = findSessionSocketWithLowestBusyness();
798
+ Socket *socket = findSocketsAcceptingHttpRequestsAndWithLowestBusyness();
749
799
  if (socket->isTotallyBusy()) {
750
800
  return SessionPtr();
751
801
  } else {
@@ -772,7 +822,7 @@ public:
772
822
 
773
823
  ~Guard() {
774
824
  if (session != NULL) {
775
- context->getSessionObjectPool().free(session);
825
+ context->sessionObjectPool.free(session);
776
826
  }
777
827
  }
778
828
 
@@ -782,8 +832,8 @@ public:
782
832
  };
783
833
 
784
834
  Context *context = getContext();
785
- LockGuard l(context->getMmSyncher());
786
- Session *session = context->getSessionObjectPool().malloc();
835
+ LockGuard l(context->memoryManagementSyncher);
836
+ Session *session = context->sessionObjectPool.malloc();
787
837
  Guard guard(context, session);
788
838
  session = new (session) Session(context, &info, socket);
789
839
  guard.clear();
@@ -882,10 +932,13 @@ public:
882
932
  for (it = sockets.begin(); it != sockets.end(); it++) {
883
933
  const Socket &socket = *it;
884
934
  stream << "<socket>";
885
- stream << "<name>" << escapeForXml(socket.name) << "</name>";
886
935
  stream << "<address>" << escapeForXml(socket.address) << "</address>";
887
936
  stream << "<protocol>" << escapeForXml(socket.protocol) << "</protocol>";
937
+ if (!socket.description.empty()) {
938
+ stream << "<description>" << escapeForXml(socket.description) << "</description>";
939
+ }
888
940
  stream << "<concurrency>" << socket.concurrency << "</concurrency>";
941
+ stream << "<accept_http_requests>" << socket.acceptHttpRequests << "</accept_http_requests>";
889
942
  stream << "<sessions>" << socket.sessions << "</sessions>";
890
943
  stream << "</socket>";
891
944
  }