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
@@ -110,8 +110,8 @@ private:
110
110
 
111
111
  void destroySelf() const {
112
112
  this->~Session();
113
- LockGuard l(context->getMmSyncher());
114
- context->getSessionObjectPool().free(const_cast<Session *>(this));
113
+ LockGuard l(context->memoryManagementSyncher);
114
+ context->sessionObjectPool.free(const_cast<Session *>(this));
115
115
  }
116
116
 
117
117
  public:
@@ -98,11 +98,17 @@ private:
98
98
 
99
99
  public:
100
100
  // Socket properties. Read-only.
101
- StaticString name;
102
101
  StaticString address;
103
102
  StaticString protocol;
103
+ StaticString description;
104
104
  pid_t pid;
105
+ /**
106
+ * Special values:
107
+ * 0 = unlimited concurrency
108
+ * -1 = unknown
109
+ */
105
110
  int concurrency;
111
+ bool acceptHttpRequests;
106
112
 
107
113
  // Private. In public section as alignment optimization.
108
114
  int totalConnections;
@@ -113,16 +119,18 @@ public:
113
119
 
114
120
  Socket()
115
121
  : pid(-1),
116
- concurrency(0)
122
+ concurrency(-1),
123
+ acceptHttpRequests(0)
117
124
  { }
118
125
 
119
- Socket(pid_t _pid, const StaticString &_name, const StaticString &_address,
120
- const StaticString &_protocol, int _concurrency)
121
- : name(_name),
122
- address(_address),
126
+ Socket(pid_t _pid, const StaticString &_address, const StaticString &_protocol,
127
+ const StaticString &_description, int _concurrency, bool _acceptHttpRequests)
128
+ : address(_address),
123
129
  protocol(_protocol),
130
+ description(_description),
124
131
  pid(_pid),
125
132
  concurrency(_concurrency),
133
+ acceptHttpRequests(_acceptHttpRequests),
126
134
  totalConnections(0),
127
135
  totalIdleConnections(0),
128
136
  sessions(0)
@@ -130,11 +138,12 @@ public:
130
138
 
131
139
  Socket(const Socket &other)
132
140
  : idleConnections(other.idleConnections),
133
- name(other.name),
134
141
  address(other.address),
135
142
  protocol(other.protocol),
143
+ description(other.description),
136
144
  pid(other.pid),
137
145
  concurrency(other.concurrency),
146
+ acceptHttpRequests(other.acceptHttpRequests),
138
147
  totalConnections(other.totalConnections),
139
148
  totalIdleConnections(other.totalIdleConnections),
140
149
  sessions(other.sessions)
@@ -144,11 +153,12 @@ public:
144
153
  totalConnections = other.totalConnections;
145
154
  totalIdleConnections = other.totalIdleConnections;
146
155
  idleConnections = other.idleConnections;
147
- name = other.name;
148
156
  address = other.address;
149
157
  protocol = other.protocol;
158
+ description = other.description;
150
159
  pid = other.pid;
151
160
  concurrency = other.concurrency;
161
+ acceptHttpRequests = other.acceptHttpRequests;
152
162
  sessions = other.sessions;
153
163
  return *this;
154
164
  }
@@ -227,15 +237,15 @@ public:
227
237
  /* Different sockets within a Process may have different
228
238
  * 'concurrency' values. We want:
229
239
  * - the socket with the smallest busyness to be be picked for routing.
230
- * - to give sockets with concurrency == 0 more priority (in general)
240
+ * - to give sockets with concurrency == 0 or -1 more priority (in general)
231
241
  * over sockets with concurrency > 0.
232
242
  * Therefore, in case of sockets with concurrency > 0, we describe our
233
243
  * busyness as a percentage of 'concurrency', with the percentage value
234
244
  * in [0..INT_MAX] instead of [0..1]. That way, the busyness value
235
245
  * of sockets with concurrency > 0 is usually higher than that of sockets
236
- * with concurrency == 0.
246
+ * with concurrency == 0 or -1.
237
247
  */
238
- if (concurrency == 0) {
248
+ if (concurrency <= 0) {
239
249
  return sessions;
240
250
  } else {
241
251
  return (int) (((long long) sessions * INT_MAX) / (double) concurrency);
@@ -247,39 +257,30 @@ public:
247
257
  }
248
258
 
249
259
  void recreateStrings(psg_pool_t *newPool) {
250
- recreateString(newPool, name);
251
260
  recreateString(newPool, address);
252
261
  recreateString(newPool, protocol);
262
+ recreateString(newPool, description);
253
263
  }
254
264
  };
255
265
 
256
266
  class SocketList: public SmallVector<Socket, 1> {
257
267
  public:
258
- void add(pid_t pid, const StaticString &name, const StaticString &address,
259
- const StaticString &protocol, int concurrency)
268
+ void add(pid_t pid, const StaticString &address, const StaticString &protocol,
269
+ const StaticString &description, int concurrency, bool acceptHttpRequests)
260
270
  {
261
- push_back(Socket(pid, name, address, protocol, concurrency));
271
+ push_back(Socket(pid, address, protocol, description, concurrency,
272
+ acceptHttpRequests));
262
273
  }
263
274
 
264
- const Socket *findSocketWithName(const StaticString &name) const {
275
+ const Socket *findFirstSocketWithProtocol(const StaticString &protocol) const {
265
276
  const_iterator it, end = this->end();
266
277
  for (it = begin(); it != end; it++) {
267
- if (it->name == name) {
278
+ if (it->protocol == protocol) {
268
279
  return &(*it);
269
280
  }
270
281
  }
271
282
  return NULL;
272
283
  }
273
-
274
- bool hasSessionSockets() const {
275
- const_iterator it;
276
- for (it = begin(); it != end(); it++) {
277
- if (it->protocol == "session" || it->protocol == "http_session") {
278
- return true;
279
- }
280
- }
281
- return false;
282
- }
283
284
  };
284
285
 
285
286
  typedef boost::shared_ptr<SocketList> SocketListPtr;
@@ -153,7 +153,7 @@ using namespace std;
153
153
  * security_update_checker_interval unsigned integer - default(86400)
154
154
  * security_update_checker_proxy_url string - -
155
155
  * security_update_checker_url string - default("https://securitycheck.phusionpassenger.com/v1/check.json")
156
- * server_software string - default("Phusion_Passenger/5.2.3")
156
+ * server_software string - default("Phusion_Passenger/5.3.0")
157
157
  * show_version_in_header boolean - default(true)
158
158
  * single_app_mode_app_root string - default,read_only
159
159
  * single_app_mode_app_type string - read_only
@@ -162,8 +162,6 @@ using namespace std;
162
162
  * stat_throttle_rate unsigned integer - default(10)
163
163
  * turbocaching boolean - default(true),read_only
164
164
  * user_switching boolean - default(true)
165
- * ust_router_address string - -
166
- * ust_router_password string - secret
167
165
  * vary_turbocache_by_cookie string - -
168
166
  * watchdog_fd_passing_password string - secret
169
167
  * web_server_module_version string - read_only
@@ -291,11 +291,9 @@ asyncCommitConfigChange(ConfigChangeRequest *req, const CommitConfigChangeCallba
291
291
  wo->appPool->setMax(coreConfig->get("max_pool_size").asInt());
292
292
  wo->appPool->setMaxIdleTime(coreConfig->get("pool_idle_time").asInt() * 1000000ULL);
293
293
  wo->appPool->enableSelfChecking(coreConfig->get("pool_selfchecks").asBool());
294
- wo->appPool->setAgentConfig(coreConfig->inspectEffectiveValues());
295
-
296
294
  {
297
- boost::lock_guard<boost::mutex> l(wo->spawningKitConfig->agentConfigSyncher);
298
- wo->spawningKitConfig->agentConfig = coreConfig->inspectEffectiveValues();
295
+ LockGuard l(wo->appPoolContext->agentConfigSyncher);
296
+ wo->appPoolContext->agentConfig = coreConfig->inspectEffectiveValues();
299
297
  }
300
298
 
301
299
  for (unsigned int i = 0; i < wo->threadWorkingObjects.size(); i++) {
@@ -78,12 +78,10 @@
78
78
  #include <Utils/JsonUtils.h>
79
79
  #include <Utils/HttpConstants.h>
80
80
  #include <Utils/Timer.h>
81
- #include <Core/ApplicationPool/ErrorRenderer.h>
82
81
  #include <Core/Controller/Config.h>
83
82
  #include <Core/Controller/Client.h>
84
83
  #include <Core/Controller/AppResponse.h>
85
84
  #include <Core/Controller/TurboCaching.h>
86
- #include <Core/UnionStation/Context.h>
87
85
 
88
86
  namespace Passenger {
89
87
 
@@ -125,7 +123,6 @@ private:
125
123
  HashedStaticString PASSENGER_STICKY_SESSIONS;
126
124
  HashedStaticString PASSENGER_STICKY_SESSIONS_COOKIE_NAME;
127
125
  HashedStaticString PASSENGER_REQUEST_OOB_WORK;
128
- HashedStaticString UNION_STATION_SUPPORT;
129
126
  HashedStaticString REMOTE_ADDR;
130
127
  HashedStaticString REMOTE_PORT;
131
128
  HashedStaticString REMOTE_USER;
@@ -182,7 +179,6 @@ private:
182
179
  const HashedStaticString &name);
183
180
  void createNewPoolOptions(Client *client, Request *req,
184
181
  const HashedStaticString &appGroupName);
185
- void initializeUnionStation(Client *client, Request *req, RequestAnalysis &analysis);
186
182
  void setStickySessionId(Client *client, Request *req);
187
183
  const LString *getStickySessionCookieName(Request *req);
188
184
 
@@ -212,11 +208,11 @@ private:
212
208
  void writeRequestQueueFullExceptionErrorResponse(Client *client,
213
209
  Request *req, const boost::shared_ptr<RequestQueueFullException> &e);
214
210
  void writeSpawnExceptionErrorResponse(Client *client, Request *req,
215
- const boost::shared_ptr<SpawnException> &e);
211
+ const boost::shared_ptr<SpawningKit::SpawnException> &e);
216
212
  void writeOtherExceptionErrorResponse(Client *client, Request *req,
217
213
  const ExceptionPtr &e);
218
214
  void endRequestWithErrorResponse(Client **c, Request **r,
219
- const StaticString &message, const SpawnException *e = NULL);
215
+ const SpawningKit::SpawnException &e);
220
216
  bool friendlyErrorPagesEnabled(Request *req);
221
217
 
222
218
 
@@ -293,7 +289,6 @@ private:
293
289
  void handleAppResponseBodyEnd(Client *client, Request *req);
294
290
  OXT_FORCE_INLINE void keepAliveAppConnection(Client *client, Request *req);
295
291
  void storeAppResponseInTurboCache(Client *client, Request *req);
296
- void finalizeUnionStationWithSuccess(Client *client, Request *req);
297
292
 
298
293
 
299
294
  /***** Hooks ******/
@@ -370,7 +365,6 @@ public:
370
365
  // Dependencies
371
366
  ResourceLocator *resourceLocator;
372
367
  PoolPtr appPool;
373
- UnionStation::ContextPtr unionStationContext;
374
368
 
375
369
 
376
370
  /****** Initialization and shutdown ******/
@@ -53,7 +53,6 @@ Controller::beginBufferingBody(Client *client, Request *req) {
53
53
  req->bodyChannel.start();
54
54
  req->bodyBuffer.reinitialize();
55
55
  req->bodyBuffer.stop();
56
- req->beginStopwatchLog(&req->stopwatchLogs.bufferingRequestBody, "buffering request body");
57
56
  }
58
57
 
59
58
  /**
@@ -128,7 +127,6 @@ Controller::whenBufferingBody_onRequestBody(Client *client, Request *req,
128
127
  req->headers.erase(HTTP_TRANSFER_ENCODING);
129
128
  req->headers.insert(&header, req->pool);
130
129
  }
131
- req->endStopwatchLog(&req->stopwatchLogs.bufferingRequestBody);
132
130
  checkoutSession(client, req);
133
131
  return Channel::Result(0, true);
134
132
  } else {
@@ -24,6 +24,7 @@
24
24
  * THE SOFTWARE.
25
25
  */
26
26
  #include <Core/Controller.h>
27
+ #include <Core/SpawningKit/ErrorRenderer.h>
27
28
 
28
29
  /*************************************************************************
29
30
  *
@@ -83,10 +84,7 @@ Controller::checkoutSession(Client *client, Request *req) {
83
84
 
84
85
  void
85
86
  Controller::asyncGetFromApplicationPool(Request *req, ApplicationPool2::GetCallback callback) {
86
- appPool->asyncGet(req->options, callback, true,
87
- req->useUnionStation()
88
- ? &req->stopwatchLogs.getFromPool
89
- : NULL);
87
+ appPool->asyncGet(req->options, callback, true);
90
88
  }
91
89
 
92
90
  void
@@ -146,7 +144,6 @@ Controller::sessionCheckedOutFromEventLoopThread(Client *client, Request *req,
146
144
  initiateSession(client, req);
147
145
  } else {
148
146
  UPDATE_TRACE_POINT();
149
- req->endStopwatchLog(&req->stopwatchLogs.getFromPool, false);
150
147
  reportSessionCheckoutError(client, req, e);
151
148
  }
152
149
  }
@@ -197,13 +194,6 @@ Controller::initiateSession(Client *client, Request *req) {
197
194
  }
198
195
 
199
196
  UPDATE_TRACE_POINT();
200
- if (req->useUnionStation()) {
201
- req->endStopwatchLog(&req->stopwatchLogs.getFromPool);
202
- req->logMessage("Application PID: " +
203
- toString(req->session->getPid()) +
204
- " (GUPID: " + req->session->getGupid() + ")");
205
- req->beginStopwatchLog(&req->stopwatchLogs.requestProxying, "request proxying");
206
- }
207
197
 
208
198
  UPDATE_TRACE_POINT();
209
199
  SKC_DEBUG(client, "Session initiated: fd=" << req->session->fd());
@@ -242,7 +232,8 @@ Controller::reportSessionCheckoutError(Client *client, Request *req,
242
232
  }
243
233
  }
244
234
  {
245
- boost::shared_ptr<SpawnException> e2 = dynamic_pointer_cast<SpawnException>(e);
235
+ boost::shared_ptr<SpawningKit::SpawnException> e2 =
236
+ dynamic_pointer_cast<SpawningKit::SpawnException>(e);
246
237
  if (e2 != NULL) {
247
238
  writeSpawnExceptionErrorResponse(client, req, e2);
248
239
  return;
@@ -277,13 +268,13 @@ Controller::writeRequestQueueFullExceptionErrorResponse(Client *client, Request
277
268
 
278
269
  void
279
270
  Controller::writeSpawnExceptionErrorResponse(Client *client, Request *req,
280
- const boost::shared_ptr<SpawnException> &e)
271
+ const boost::shared_ptr<SpawningKit::SpawnException> &e)
281
272
  {
282
273
  TRACE_POINT();
283
274
  SKC_ERROR(client, "Cannot checkout session because a spawning error occurred. " <<
284
- "The identifier of the error is " << e->get("error_id") << ". Please see earlier logs for " <<
275
+ "The identifier of the error is " << e->getId() << ". Please see earlier logs for " <<
285
276
  "details about the error.");
286
- endRequestWithErrorResponse(&client, &req, e->getErrorPage(), e.get());
277
+ endRequestWithErrorResponse(&client, &req, *e);
287
278
  }
288
279
 
289
280
  void
@@ -340,26 +331,23 @@ Controller::writeOtherExceptionErrorResponse(Client *client, Request *req, const
340
331
  }
341
332
  }
342
333
 
343
- /**
344
- * `message` will be copied and doesn't need to outlive the request.
345
- */
346
334
  void
347
- Controller::endRequestWithErrorResponse(Client **c, Request **r, const StaticString &message,
348
- const SpawnException *e)
335
+ Controller::endRequestWithErrorResponse(Client **c, Request **r,
336
+ const SpawningKit::SpawnException &e)
349
337
  {
350
338
  TRACE_POINT();
351
339
  Client *client = *c;
352
340
  Request *req = *r;
353
- ErrorRenderer renderer(*resourceLocator);
341
+ SpawningKit::ErrorRenderer renderer(*appPool->getSpawningKitContext());
354
342
  string data;
355
343
 
356
344
  if (friendlyErrorPagesEnabled(req)) {
357
345
  try {
358
- data = renderer.renderWithDetails(message, req->options, e);
346
+ data = renderer.renderWithDetails(e);
359
347
  } catch (const SystemException &e2) {
360
348
  SKC_ERROR(client, "Cannot render an error page: " << e2.what() <<
361
349
  "\n" << e2.backtrace());
362
- data = message;
350
+ data = e.getSummary();
363
351
  }
364
352
  } else {
365
353
  try {
@@ -111,15 +111,13 @@ parseControllerBenchmarkMode(const StaticString &mode) {
111
111
  * multi_app boolean - default(true),read_only
112
112
  * request_freelist_limit unsigned integer - default(1024)
113
113
  * response_buffer_high_watermark unsigned integer - default(134217728)
114
- * server_software string - default("Phusion_Passenger/5.2.3")
114
+ * server_software string - default("Phusion_Passenger/5.3.0")
115
115
  * show_version_in_header boolean - default(true)
116
116
  * start_reading_after_accept boolean - default(true)
117
117
  * stat_throttle_rate unsigned integer - default(10)
118
118
  * thread_number unsigned integer required read_only
119
119
  * turbocaching boolean - default(true),read_only
120
120
  * user_switching boolean - default(true)
121
- * ust_router_address string - -
122
- * ust_router_password string - secret
123
121
  * vary_turbocache_by_cookie string - -
124
122
  *
125
123
  * END
@@ -144,8 +142,6 @@ private:
144
142
  add("default_ruby", STRING_TYPE, OPTIONAL, DEFAULT_RUBY);
145
143
  add("default_python", STRING_TYPE, OPTIONAL, DEFAULT_PYTHON);
146
144
  add("default_nodejs", STRING_TYPE, OPTIONAL, DEFAULT_NODEJS);
147
- add("ust_router_address", STRING_TYPE, OPTIONAL);
148
- add("ust_router_password", STRING_TYPE, OPTIONAL | SECRET);
149
145
  add("default_user", STRING_TYPE, OPTIONAL, DEFAULT_WEB_APP_USER);
150
146
  addWithDynamicDefault(
151
147
  "default_group", STRING_TYPE, OPTIONAL | CACHE_DEFAULT_VALUE,
@@ -387,8 +383,6 @@ public:
387
383
  StaticString defaultRuby;
388
384
  StaticString defaultPython;
389
385
  StaticString defaultNodejs;
390
- StaticString ustRouterAddress;
391
- StaticString ustRouterPassword;
392
386
  StaticString defaultUser;
393
387
  StaticString defaultGroup;
394
388
  StaticString defaultServerName;
@@ -421,8 +415,6 @@ public:
421
415
  defaultRuby(psg_pstrdup(pool, config["default_ruby"].asString())),
422
416
  defaultPython(psg_pstrdup(pool, config["default_python"].asString())),
423
417
  defaultNodejs(psg_pstrdup(pool, config["default_nodejs"].asString())),
424
- ustRouterAddress(psg_pstrdup(pool, config["ust_router_address"].asString())),
425
- ustRouterPassword(psg_pstrdup(pool, config["ust_router_password"].asString())),
426
418
  defaultUser(psg_pstrdup(pool, config["default_user"].asString())),
427
419
  defaultGroup(psg_pstrdup(pool, config["default_group"].asString())),
428
420
  defaultServerName(psg_pstrdup(pool, config["default_server_name"].asString())),
@@ -894,33 +894,6 @@ Controller::logResponseHeaders(Client *client, Request *req, struct iovec *buffe
894
894
  SKC_TRACE(client, 3, "Sending response headers: \"" <<
895
895
  cEscapeString(StaticString(buffer, dataSize)) << "\"");
896
896
  }
897
-
898
- if (req->useUnionStation()) {
899
- TRACE_POINT();
900
- const char *status = getStatusCodeAndReasonPhrase(req->appResponse.statusCode);
901
- if (status != NULL) {
902
- req->logMessage("Status: " + StaticString(status));
903
- } else {
904
- req->logMessage("Status: " + toString(req->appResponse.statusCode));
905
- }
906
-
907
- if (req->appResponse.statusCode >= 400 && req->appResponse.statusCode <= 599) {
908
- // Log the request headers like Request headers: { header1: values1-concatenated, header2: values2-concatenated } (single line)
909
- // Concatenation was already done by HeaderTable.h:insert (using a comma ',' for joining, or a semicolon ';' for Cookie headers
910
- UPDATE_TRACE_POINT();
911
- ServerKit::HeaderTable::Iterator it(req->headers);
912
- Json::Value json;
913
- while (*it != NULL) {
914
- const LString *hdr = psg_lstr_make_contiguous(&it->header->key, req->pool);
915
- const LString *val = psg_lstr_make_contiguous(&it->header->val, req->pool);
916
- // Due to the above mentioned concatenation, header keys are unique and we don't need to worry
917
- // about encountering multiple of the same key, so we can just assign.
918
- json[std::string(hdr->start->data, hdr->size)] = std::string(val->start->data, val->size);
919
- it.next();
920
- }
921
- req->logMessage("Request headers: " + stringifyJson(json));
922
- }
923
- }
924
897
  }
925
898
 
926
899
  void
@@ -1082,7 +1055,6 @@ void
1082
1055
  Controller::handleAppResponseBodyEnd(Client *client, Request *req) {
1083
1056
  keepAliveAppConnection(client, req);
1084
1057
  storeAppResponseInTurboCache(client, req);
1085
- finalizeUnionStationWithSuccess(client, req);
1086
1058
  assert(!req->ended());
1087
1059
  }
1088
1060
 
@@ -1145,12 +1117,6 @@ Controller::storeAppResponseInTurboCache(Client *client, Request *req) {
1145
1117
  }
1146
1118
  }
1147
1119
 
1148
- void
1149
- Controller::finalizeUnionStationWithSuccess(Client *client, Request *req) {
1150
- req->endStopwatchLog(&req->stopwatchLogs.requestProxying, true);
1151
- req->endStopwatchLog(&req->stopwatchLogs.requestProcessing, true);
1152
- }
1153
-
1154
1120
 
1155
1121
  } // namespace Core
1156
1122
  } // namespace Passenger
@@ -157,13 +157,6 @@ Controller::deinitializeRequest(Client *client, Request *req) {
157
157
  req->session.reset();
158
158
  req->config.reset();
159
159
 
160
- req->endStopwatchLog(&req->stopwatchLogs.getFromPool, false);
161
- req->endStopwatchLog(&req->stopwatchLogs.bufferingRequestBody, false);
162
- req->endStopwatchLog(&req->stopwatchLogs.requestProxying, false);
163
- req->endStopwatchLog(&req->stopwatchLogs.requestProcessing, false);
164
-
165
- req->options.transaction.reset();
166
-
167
160
  req->appSink.setConsumedCallback(NULL);
168
161
  req->appSink.deinitialize();
169
162
  req->appSource.deinitialize();