passenger 5.0.10 → 5.0.11

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 (124) hide show
  1. checksums.yaml +8 -8
  2. checksums.yaml.gz.asc +7 -7
  3. data.tar.gz.asc +7 -7
  4. data/CHANGELOG +18 -0
  5. data/CONTRIBUTING.md +3 -3
  6. data/bin/passenger-status +12 -4
  7. data/build/agents.rb +45 -45
  8. data/build/apache2.rb +1 -1
  9. data/build/basics.rb +1 -1
  10. data/build/cxx_tests.rb +12 -12
  11. data/doc/CloudLicensingConfiguration.html +10 -10
  12. data/doc/CloudLicensingConfiguration.txt.md +10 -10
  13. data/doc/DebuggingAndStressTesting.md +3 -3
  14. data/doc/Design and Architecture.html +30 -30
  15. data/doc/Design and Architecture.txt +28 -28
  16. data/doc/ServerOptimizationGuide.html +3 -3
  17. data/doc/ServerOptimizationGuide.txt.md +3 -3
  18. data/doc/Users guide Apache.html +24 -12
  19. data/doc/Users guide Apache.txt +2 -2
  20. data/doc/Users guide Nginx.html +24 -12
  21. data/doc/Users guide Nginx.txt +2 -2
  22. data/doc/Users guide Standalone.html +18 -6
  23. data/doc/images/passenger_architecture.png +0 -0
  24. data/doc/images/passenger_architecture.svg +10 -9
  25. data/doc/images/{helper_agent_core_architecture.png → passenger_core_architecture.png} +0 -0
  26. data/doc/users_guide_snippets/environment_variables.txt +1 -1
  27. data/doc/users_guide_snippets/installation/verify_running_epilogue.txt +1 -1
  28. data/doc/users_guide_snippets/support_information.txt +1 -1
  29. data/doc/users_guide_snippets/tips.txt +2 -2
  30. data/doc/users_guide_snippets/under_the_hood/relationship_with_ruby.txt +1 -1
  31. data/ext/apache2/Bucket.h +5 -5
  32. data/ext/apache2/Configuration.cpp +1 -1
  33. data/ext/apache2/Configuration.hpp +2 -3
  34. data/ext/apache2/ConfigurationFields.hpp +3 -0
  35. data/ext/apache2/ConfigurationFields.hpp.erb +3 -0
  36. data/ext/apache2/Hooks.cpp +42 -34
  37. data/ext/common/Account.h +3 -3
  38. data/ext/common/AgentsStarter.cpp +7 -7
  39. data/ext/common/AgentsStarter.h +20 -20
  40. data/ext/common/ApplicationPool2/Options.h +12 -12
  41. data/ext/common/Constants.h +10 -8
  42. data/ext/common/Logging.cpp +22 -1
  43. data/ext/common/Logging.h +19 -2
  44. data/ext/common/ServerKit/AcceptLoadBalancer.h +3 -3
  45. data/ext/common/ServerKit/Server.h +24 -0
  46. data/ext/common/UnionStation/Connection.h +1 -1
  47. data/ext/common/UnionStation/Core.h +21 -21
  48. data/ext/common/UnionStation/Transaction.h +3 -3
  49. data/ext/common/Utils.cpp +2 -2
  50. data/ext/common/Utils/IOUtils.cpp +5 -1
  51. data/ext/common/{agents → agent}/ApiServerUtils.h +3 -3
  52. data/ext/common/{agents → agent}/Base.cpp +2 -2
  53. data/ext/common/{agents → agent}/Base.h +0 -0
  54. data/ext/common/{agents/HelperAgent → agent/Core}/ApiServer.h +33 -9
  55. data/ext/common/{agents/HelperAgent → agent/Core}/Main.cpp +60 -59
  56. data/ext/common/{agents/HelperAgent → agent/Core}/OptionParser.h +32 -25
  57. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler.h +17 -17
  58. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/AppResponse.h +0 -0
  59. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/BufferBody.cpp +0 -0
  60. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/CheckoutSession.cpp +0 -0
  61. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/Client.h +2 -2
  62. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/ForwardResponse.cpp +0 -0
  63. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/Hooks.cpp +0 -0
  64. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/InitRequest.cpp +4 -3
  65. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/Request.h +1 -1
  66. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/SendRequest.cpp +0 -0
  67. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/TurboCaching.h +1 -1
  68. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/Utils.cpp +0 -0
  69. data/ext/common/{agents/HelperAgent → agent/Core}/ResponseCache.h +0 -0
  70. data/ext/common/{agents → agent}/Main.cpp +9 -9
  71. data/ext/common/{agents → agent}/SpawnPreparer/Main.cpp +0 -0
  72. data/ext/common/{agents/HelperAgent/SystemMetricsTool.cpp → agent/SystemMetrics/Main.cpp} +0 -0
  73. data/ext/common/{agents → agent}/TempDirToucher/Main.cpp +0 -0
  74. data/ext/common/{agents/LoggingAgent → agent/UstRouter}/ApiServer.h +7 -7
  75. data/ext/common/{agents/LoggingAgent → agent/UstRouter}/DataStoreId.h +0 -0
  76. data/ext/common/{agents/LoggingAgent → agent/UstRouter}/FilterSupport.cpp +0 -0
  77. data/ext/common/{agents/LoggingAgent → agent/UstRouter}/FilterSupport.h +0 -0
  78. data/ext/common/{agents/LoggingAgent → agent/UstRouter}/LoggingServer.h +4 -4
  79. data/ext/common/{agents/LoggingAgent → agent/UstRouter}/Main.cpp +45 -45
  80. data/ext/common/{agents/LoggingAgent → agent/UstRouter}/OptionParser.h +20 -20
  81. data/ext/common/{agents/LoggingAgent → agent/UstRouter}/RemoteSender.h +0 -0
  82. data/ext/common/{agents → agent}/Watchdog/AgentWatcher.cpp +0 -0
  83. data/ext/common/{agents → agent}/Watchdog/ApiServer.h +1 -1
  84. data/ext/common/{agents/Watchdog/HelperAgentWatcher.cpp → agent/Watchdog/CoreWatcher.cpp} +14 -10
  85. data/ext/common/{agents → agent}/Watchdog/InstanceDirToucher.cpp +0 -0
  86. data/ext/common/{agents → agent}/Watchdog/Main.cpp +131 -75
  87. data/ext/common/{agents/Watchdog/LoggingAgentWatcher.cpp → agent/Watchdog/UstRouterWatcher.cpp} +13 -9
  88. data/ext/nginx/CacheLocationConfig.c +11 -6
  89. data/ext/nginx/CacheLocationConfig.c.erb +11 -6
  90. data/ext/nginx/Configuration.c +22 -7
  91. data/ext/nginx/Configuration.h +1 -19
  92. data/ext/nginx/ConfigurationFields.h +19 -0
  93. data/ext/nginx/ConfigurationFields.h.erb +19 -0
  94. data/ext/nginx/ContentHandler.c +33 -33
  95. data/ext/nginx/CreateLocationConfig.c +3 -1
  96. data/ext/nginx/CreateLocationConfig.c.erb +3 -1
  97. data/ext/nginx/MergeLocationConfig.c +8 -4
  98. data/ext/nginx/MergeLocationConfig.c.erb +7 -3
  99. data/ext/nginx/ngx_http_passenger_module.c +33 -42
  100. data/helper-scripts/backtrace-sanitizer.rb +2 -2
  101. data/lib/phusion_passenger.rb +1 -1
  102. data/lib/phusion_passenger/admin_tools/instance.rb +2 -2
  103. data/lib/phusion_passenger/admin_tools/instance_registry.rb +7 -3
  104. data/lib/phusion_passenger/common_library.rb +8 -8
  105. data/lib/phusion_passenger/config/about_command.rb +1 -1
  106. data/lib/phusion_passenger/config/api_call_command.rb +3 -3
  107. data/lib/phusion_passenger/config/installation_utils.rb +34 -21
  108. data/lib/phusion_passenger/config/reopen_logs_command.rb +2 -2
  109. data/lib/phusion_passenger/config/restart_app_command.rb +18 -4
  110. data/lib/phusion_passenger/constants.rb +7 -5
  111. data/lib/phusion_passenger/loader_shared_helpers.rb +2 -6
  112. data/lib/phusion_passenger/message_client.rb +8 -8
  113. data/lib/phusion_passenger/platform_info/ruby.rb +1 -2
  114. data/lib/phusion_passenger/preloader_shared_helpers.rb +1 -1
  115. data/lib/phusion_passenger/request_handler.rb +3 -2
  116. data/lib/phusion_passenger/request_handler/thread_handler.rb +4 -4
  117. data/lib/phusion_passenger/standalone/start_command.rb +13 -3
  118. data/lib/phusion_passenger/standalone/start_command/builtin_engine.rb +2 -1
  119. data/lib/phusion_passenger/union_station/core.rb +18 -18
  120. data/lib/phusion_passenger/union_station/transaction.rb +5 -5
  121. data/resources/oss-binaries.phusionpassenger.com.crt +0 -84
  122. data/resources/templates/standalone/config.erb +1 -0
  123. metadata +40 -40
  124. metadata.gz.asc +7 -7
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2010-2014 Phusion
3
+ * Copyright (c) 2010-2015 Phusion
4
4
  *
5
5
  * "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
6
  *
@@ -188,7 +188,7 @@ public:
188
188
  guard.clear();
189
189
  if (connection->disconnect(errorResponse)) {
190
190
  handleException(IOException(
191
- "Logging agent disconnected with error: " +
191
+ "UstRouter disconnected with error: " +
192
192
  errorResponse));
193
193
  } else {
194
194
  handleException(e);
@@ -230,7 +230,7 @@ public:
230
230
  guard.clear();
231
231
  if (connection->disconnect(errorResponse)) {
232
232
  handleException(IOException(
233
- "Logging agent disconnected with error: " +
233
+ "UstRouter disconnected with error: " +
234
234
  errorResponse));
235
235
  } else {
236
236
  handleException(e);
@@ -775,9 +775,9 @@ prestartWebApps(const ResourceLocator &locator, const string &ruby,
775
775
  const vector<string> &prestartURLs)
776
776
  {
777
777
  /* Apache calls the initialization routines twice during startup, and
778
- * as a result it starts two helper servers, where the first one exits
778
+ * as a result it starts two watchdogs, where the first one exits
779
779
  * after a short idle period. We want any prespawning requests to reach
780
- * the second helper server, so we sleep for a short period before
780
+ * the second watchdog, so we sleep for a short period before
781
781
  * executing the prespawning scripts.
782
782
  */
783
783
  syscalls::sleep(2);
@@ -1193,6 +1193,7 @@ readPeerCredentials(int sock, uid_t *uid, gid_t *gid) {
1193
1193
  struct sockaddr_in inetAddress;
1194
1194
  } addr;
1195
1195
  socklen_t len = sizeof(addr);
1196
+ int ret;
1196
1197
 
1197
1198
  /*
1198
1199
  * The functions for receiving the peer credentials are not guaranteed to
@@ -1200,7 +1201,10 @@ readPeerCredentials(int sock, uid_t *uid, gid_t *gid) {
1200
1201
  * just returns garbage when invoked on a TCP socket. So we check here
1201
1202
  * whether 'sock' is a Unix domain socket.
1202
1203
  */
1203
- if (getsockname(sock, &addr.genericAddress, &len) == -1) {
1204
+ do {
1205
+ ret = getsockname(sock, &addr.genericAddress, &len);
1206
+ } while (ret == -1 && errno == EINTR);
1207
+ if (ret == -1) {
1204
1208
  int e = errno;
1205
1209
  throw SystemException("Unable to autodetect socket type (getsockname() failed)", e);
1206
1210
  }
@@ -26,8 +26,8 @@
26
26
  #define _PASSENGER_API_SERVER_UTILS_H_
27
27
 
28
28
  /**
29
- * Utility code shared by HelperAgent/ApiServer.h, LoggingAgent/ApiServer.h
30
- * and Watchdog/ApiServer.h. This code handles authentication and authorization
29
+ * Utility code shared by agent/Core/ApiServer.h, agent/UstRouter/ApiServer.h
30
+ * and agent/Watchdog/ApiServer.h. This code handles authentication and authorization
31
31
  * of connected ApiServer clients.
32
32
  *
33
33
  * This file consists of the following items.
@@ -202,7 +202,7 @@ struct Authorization {
202
202
  bool canAdminister;
203
203
 
204
204
  Authorization()
205
- : uid(-1),
205
+ : uid((uid_t) -1),
206
206
  canReadPool(false),
207
207
  canModifyPool(false),
208
208
  canInspectState(false),
@@ -57,7 +57,7 @@
57
57
  #include <string>
58
58
  #include <vector>
59
59
 
60
- #include <agents/Base.h>
60
+ #include <agent/Base.h>
61
61
  #include <Constants.h>
62
62
  #include <Exceptions.h>
63
63
  #include <Logging.h>
@@ -1399,7 +1399,7 @@ lookupErrno(const char *name) {
1399
1399
  static void
1400
1400
  initializeSyscallFailureSimulation(const char *processName) {
1401
1401
  // Format:
1402
- // PassengerWatchdog=EMFILE:0.1,ECONNREFUSED:0.25;PassengerHelperAgent=ESPIPE=0.4
1402
+ // PassengerAgent watchdog=EMFILE:0.1,ECONNREFUSED:0.25;PassengerAgent core=ESPIPE=0.4
1403
1403
  const char *spec = getenv("PASSENGER_SIMULATE_SYSCALL_FAILURES");
1404
1404
  string prefix = string(processName) + "=";
1405
1405
  vector<string> components;
File without changes
@@ -22,8 +22,8 @@
22
22
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
23
  * THE SOFTWARE.
24
24
  */
25
- #ifndef _PASSENGER_SERVER_AGENT_API_SERVER_H_
26
- #define _PASSENGER_SERVER_AGENT_API_SERVER_H_
25
+ #ifndef _PASSENGER_CORE_API_SERVER_H_
26
+ #define _PASSENGER_CORE_API_SERVER_H_
27
27
 
28
28
  #include <boost/regex.hpp>
29
29
  #include <oxt/thread.hpp>
@@ -32,8 +32,8 @@
32
32
  #include <cstring>
33
33
  #include <sys/types.h>
34
34
 
35
- #include <agents/HelperAgent/RequestHandler.h>
36
- #include <agents/ApiServerUtils.h>
35
+ #include <agent/Core/RequestHandler.h>
36
+ #include <agent/ApiServerUtils.h>
37
37
  #include <ApplicationPool2/Pool.h>
38
38
  #include <ServerKit/HttpServer.h>
39
39
  #include <DataStructures/LString.h>
@@ -48,7 +48,7 @@
48
48
  #include <Utils/MessageIO.h>
49
49
 
50
50
  namespace Passenger {
51
- namespace ServerAgent {
51
+ namespace Core {
52
52
 
53
53
  using namespace std;
54
54
 
@@ -212,7 +212,19 @@ private:
212
212
  endRequest(&client, &req);
213
213
  }
214
214
  } else {
215
- apiServerRespondWith401(this, client, req);
215
+ HeaderTable headers;
216
+ headers.insert(req->pool, "Cache-Control", "no-cache, no-store, must-revalidate");
217
+ headers.insert(req->pool, "WWW-Authenticate", "Basic realm=\"api\"");
218
+ if (clientOnUnixDomainSocket(client) && appPool->getGroupCount() == 0) {
219
+ // Allow admin tools that connected through the Unix domain socket
220
+ // to know that this authorization error is caused by the fact
221
+ // that the pool is empty.
222
+ headers.insert(req->pool, "Pool-Empty", "true");
223
+ }
224
+ writeSimpleResponse(client, 401, &headers, "Unauthorized");
225
+ if (!req->ended()) {
226
+ endRequest(&client, &req);
227
+ }
216
228
  }
217
229
  }
218
230
 
@@ -232,7 +244,19 @@ private:
232
244
  endRequest(&client, &req);
233
245
  }
234
246
  } else {
235
- apiServerRespondWith401(this, client, req);
247
+ HeaderTable headers;
248
+ headers.insert(req->pool, "Cache-Control", "no-cache, no-store, must-revalidate");
249
+ headers.insert(req->pool, "WWW-Authenticate", "Basic realm=\"api\"");
250
+ if (clientOnUnixDomainSocket(client) && appPool->getGroupCount() == 0) {
251
+ // Allow admin tools that connected through the Unix domain socket
252
+ // to know that this authorization error is caused by the fact
253
+ // that the pool is empty.
254
+ headers.insert(req->pool, "Pool-Empty", "true");
255
+ }
256
+ writeSimpleResponse(client, 401, &headers, "Unauthorized");
257
+ if (!req->ended()) {
258
+ endRequest(&client, &req);
259
+ }
236
260
  }
237
261
  }
238
262
 
@@ -593,7 +617,7 @@ public:
593
617
  };
594
618
 
595
619
 
596
- } // namespace ServerAgent
620
+ } // namespace Core
597
621
  } // namespace Passenger
598
622
 
599
- #endif /* _PASSENGER_SERVER_AGENT_API_SERVER_H_ */
623
+ #endif /* _PASSENGER_CORE_API_SERVER_H_ */
@@ -66,11 +66,11 @@
66
66
 
67
67
  #include <ev++.h>
68
68
 
69
- #include <agents/HelperAgent/OptionParser.h>
70
- #include <agents/HelperAgent/RequestHandler.h>
71
- #include <agents/HelperAgent/ApiServer.h>
72
- #include <agents/Base.h>
73
- #include <agents/ApiServerUtils.h>
69
+ #include <agent/Core/OptionParser.h>
70
+ #include <agent/Core/RequestHandler.h>
71
+ #include <agent/Core/ApiServer.h>
72
+ #include <agent/Base.h>
73
+ #include <agent/ApiServerUtils.h>
74
74
  #include <Constants.h>
75
75
  #include <ServerKit/Server.h>
76
76
  #include <ServerKit/AcceptLoadBalancer.h>
@@ -98,7 +98,7 @@ using namespace Passenger::ApplicationPool2;
98
98
  /***** Structures, constants, global variables and forward declarations *****/
99
99
 
100
100
  namespace Passenger {
101
- namespace ServerAgent {
101
+ namespace Core {
102
102
  struct ThreadWorkingObjects {
103
103
  BackgroundEventLoop *bgloop;
104
104
  ServerKit::Context *serverKitContext;
@@ -177,23 +177,23 @@ namespace ServerAgent {
177
177
  delete apiWorkingObjects.bgloop;
178
178
  }
179
179
  };
180
- } // namespace ServerAgent
180
+ } // namespace Core
181
181
  } // namespace Passenger
182
182
 
183
- using namespace Passenger::ServerAgent;
183
+ using namespace Passenger::Core;
184
184
 
185
185
  static VariantMap *agentsOptions;
186
186
  static WorkingObjects *workingObjects;
187
187
 
188
188
 
189
- /***** Server stuff *****/
189
+ /***** Core stuff *****/
190
190
 
191
191
  static void waitForExitEvent();
192
192
  static void cleanup();
193
193
  static void deletePidFile();
194
194
  static void abortLongRunningConnections(const ApplicationPool2::ProcessPtr &process);
195
195
  static void requestHandlerShutdownFinished(RequestHandler *server);
196
- static void apiServerShutdownFinished(ServerAgent::ApiServer *server);
196
+ static void apiServerShutdownFinished(Core::ApiServer *server);
197
197
  static void printInfoInThread();
198
198
 
199
199
  static void
@@ -204,14 +204,14 @@ initializePrivilegedWorkingObjects() {
204
204
 
205
205
  wo->prestarterThread = NULL;
206
206
 
207
- wo->password = options.get("server_password", false);
207
+ wo->password = options.get("core_password", false);
208
208
  if (wo->password == "-") {
209
209
  wo->password.clear();
210
- } else if (wo->password.empty() && options.has("server_password_file")) {
211
- wo->password = strip(readAll(options.get("server_password_file")));
210
+ } else if (wo->password.empty() && options.has("core_password_file")) {
211
+ wo->password = strip(readAll(options.get("core_password_file")));
212
212
  }
213
213
 
214
- vector<string> authorizations = options.getStrSet("server_authorizations",
214
+ vector<string> authorizations = options.getStrSet("core_authorizations",
215
215
  false);
216
216
  string description;
217
217
 
@@ -231,7 +231,7 @@ initializeSingleAppMode() {
231
231
  VariantMap &options = *agentsOptions;
232
232
 
233
233
  if (options.getBool("multi_app")) {
234
- P_NOTICE(AGENT_EXE " server running in multi-application mode.");
234
+ P_NOTICE(SHORT_PROGRAM_NAME " core running in multi-application mode.");
235
235
  return;
236
236
  }
237
237
 
@@ -244,7 +244,7 @@ initializeSingleAppMode() {
244
244
  "lives in %s. Please specify information about the app using "
245
245
  "--app-type and --startup-file, or specify a correct location to "
246
246
  "the application you want to serve.\n"
247
- "Type '" AGENT_EXE " server --help' for more information.\n",
247
+ "Type '" SHORT_PROGRAM_NAME " core --help' for more information.\n",
248
248
  options.get("app_root").c_str());
249
249
  exit(1);
250
250
  }
@@ -253,7 +253,7 @@ initializeSingleAppMode() {
253
253
  options.set("startup_file", getAppTypeStartupFile(appType));
254
254
  }
255
255
 
256
- P_NOTICE(AGENT_EXE " server running in single-application mode.");
256
+ P_NOTICE(SHORT_PROGRAM_NAME " core running in single-application mode.");
257
257
  P_NOTICE("Serving app : " << options.get("app_root"));
258
258
  P_NOTICE("App type : " << options.get("app_type"));
259
259
  P_NOTICE("App startup file: " << options.get("startup_file"));
@@ -313,8 +313,8 @@ static void
313
313
  startListening() {
314
314
  TRACE_POINT();
315
315
  WorkingObjects *wo = workingObjects;
316
- vector<string> addresses = agentsOptions->getStrSet("server_addresses");
317
- vector<string> apiAddresses = agentsOptions->getStrSet("server_api_addresses", false);
316
+ vector<string> addresses = agentsOptions->getStrSet("core_addresses");
317
+ vector<string> apiAddresses = agentsOptions->getStrSet("core_api_addresses", false);
318
318
 
319
319
  #ifdef USE_SELINUX
320
320
  // Set SELinux context on the first socket that we create
@@ -348,7 +348,7 @@ startListening() {
348
348
  static void
349
349
  createPidFile() {
350
350
  TRACE_POINT();
351
- string pidFile = agentsOptions->get("server_pid_file", false);
351
+ string pidFile = agentsOptions->get("core_pid_file", false);
352
352
  if (!pidFile.empty()) {
353
353
  char pidStr[32];
354
354
 
@@ -532,8 +532,8 @@ initializeNonPrivilegedWorkingObjects() {
532
532
  setenv("SERVER_SOFTWARE", options.get("server_software").c_str(), 1);
533
533
  options.set("data_buffer_dir", absolutizePath(options.get("data_buffer_dir")));
534
534
 
535
- vector<string> addresses = options.getStrSet("server_addresses");
536
- vector<string> apiAddresses = options.getStrSet("server_api_addresses", false);
535
+ vector<string> addresses = options.getStrSet("core_addresses");
536
+ vector<string> apiAddresses = options.getStrSet("core_api_addresses", false);
537
537
 
538
538
  wo->resourceLocator = ResourceLocator(options.get("passenger_root"));
539
539
 
@@ -546,11 +546,11 @@ initializeNonPrivilegedWorkingObjects() {
546
546
  }
547
547
 
548
548
  UPDATE_TRACE_POINT();
549
- if (options.has("logging_agent_address")) {
549
+ if (options.has("ust_router_address")) {
550
550
  wo->unionStationCore = boost::make_shared<UnionStation::Core>(
551
- options.get("logging_agent_address"),
551
+ options.get("ust_router_address"),
552
552
  "logging",
553
- options.get("logging_agent_password"));
553
+ options.get("ust_router_password"));
554
554
  }
555
555
 
556
556
  UPDATE_TRACE_POINT();
@@ -577,7 +577,7 @@ initializeNonPrivilegedWorkingObjects() {
577
577
  wo->appPool->abortLongRunningConnectionsCallback = abortLongRunningConnections;
578
578
 
579
579
  UPDATE_TRACE_POINT();
580
- unsigned int nthreads = options.getInt("server_threads");
580
+ unsigned int nthreads = options.getInt("core_threads");
581
581
  BackgroundEventLoop *firstLoop = NULL; // Avoid compiler warning
582
582
  wo->threadWorkingObjects.reserve(nthreads);
583
583
  for (unsigned int i = 0; i < nthreads; i++) {
@@ -636,7 +636,7 @@ initializeNonPrivilegedWorkingObjects() {
636
636
  options.getUint("file_buffer_threshold");
637
637
 
638
638
  UPDATE_TRACE_POINT();
639
- awo->apiServer = new ServerAgent::ApiServer(awo->serverKitContext);
639
+ awo->apiServer = new Core::ApiServer(awo->serverKitContext);
640
640
  awo->apiServer->requestHandlers.reserve(wo->threadWorkingObjects.size());
641
641
  for (unsigned int i = 0; i < wo->threadWorkingObjects.size(); i++) {
642
642
  awo->apiServer->requestHandlers.push_back(
@@ -704,16 +704,16 @@ static void
704
704
  reportInitializationInfo() {
705
705
  TRACE_POINT();
706
706
  if (feedbackFdAvailable()) {
707
- P_NOTICE(AGENT_EXE " server online, PID " << getpid());
707
+ P_NOTICE(SHORT_PROGRAM_NAME " core online, PID " << getpid());
708
708
  writeArrayMessage(FEEDBACK_FD,
709
709
  "initialized",
710
710
  NULL);
711
711
  } else {
712
- vector<string> addresses = agentsOptions->getStrSet("server_addresses");
713
- vector<string> apiAddresses = agentsOptions->getStrSet("server_api_addresses", false);
712
+ vector<string> addresses = agentsOptions->getStrSet("core_addresses");
713
+ vector<string> apiAddresses = agentsOptions->getStrSet("core_api_addresses", false);
714
714
  string address;
715
715
 
716
- P_NOTICE(AGENT_EXE " server online, PID " << getpid() <<
716
+ P_NOTICE(SHORT_PROGRAM_NAME " core online, PID " << getpid() <<
717
717
  ", listening on " << addresses.size() << " socket(s):");
718
718
  foreach (address, addresses) {
719
719
  if (startsWith(address, "tcp://")) {
@@ -744,7 +744,7 @@ mainLoop() {
744
744
  WorkingObjects *wo = workingObjects;
745
745
  #ifdef SUPPORTS_PER_THREAD_CPU_AFFINITY
746
746
  unsigned int maxCpus = boost::thread::hardware_concurrency();
747
- bool cpuAffine = agentsOptions->getBool("server_cpu_affine")
747
+ bool cpuAffine = agentsOptions->getBool("core_cpu_affine")
748
748
  && maxCpus <= CPU_SETSIZE;
749
749
  #endif
750
750
 
@@ -759,12 +759,12 @@ mainLoop() {
759
759
 
760
760
  CPU_ZERO(&cpus);
761
761
  CPU_SET(i % maxCpus, &cpus);
762
- P_DEBUG("Setting CPU affinity of server thread " << (i + 1)
762
+ P_DEBUG("Setting CPU affinity of core thread " << (i + 1)
763
763
  << " to CPU " << (i % maxCpus + 1));
764
764
  result = pthread_setaffinity_np(two->bgloop->getNativeHandle(),
765
765
  maxCpus, &cpus);
766
766
  if (result != 0) {
767
- P_WARN("Cannot set CPU affinity on server thread " << (i + 1)
767
+ P_WARN("Cannot set CPU affinity on core thread " << (i + 1)
768
768
  << ": " << strerror(result) << " (errno=" << result << ")");
769
769
  }
770
770
  }
@@ -825,7 +825,7 @@ requestHandlerShutdownFinished(RequestHandler *server) {
825
825
  }
826
826
 
827
827
  static void
828
- apiServerShutdownFinished(ServerAgent::ApiServer *server) {
828
+ apiServerShutdownFinished(Core::ApiServer *server) {
829
829
  serverShutdownFinished();
830
830
  }
831
831
 
@@ -907,7 +907,7 @@ cleanup() {
907
907
  TRACE_POINT();
908
908
  WorkingObjects *wo = workingObjects;
909
909
 
910
- P_DEBUG("Shutting down " AGENT_EXE " server...");
910
+ P_DEBUG("Shutting down " SHORT_PROGRAM_NAME " core...");
911
911
  wo->appPool->destroy();
912
912
  installDiagnosticsDumper(NULL, NULL);
913
913
  for (unsigned i = 0; i < wo->threadWorkingObjects.size(); i++) {
@@ -939,22 +939,22 @@ cleanup() {
939
939
  deletePidFile();
940
940
  delete workingObjects;
941
941
  workingObjects = NULL;
942
- P_NOTICE(AGENT_EXE " server shutdown finished");
942
+ P_NOTICE(SHORT_PROGRAM_NAME " core shutdown finished");
943
943
  }
944
944
 
945
945
  static void
946
946
  deletePidFile() {
947
947
  TRACE_POINT();
948
- string pidFile = agentsOptions->get("server_pid_file", false);
948
+ string pidFile = agentsOptions->get("core_pid_file", false);
949
949
  if (!pidFile.empty()) {
950
950
  syscalls::unlink(pidFile.c_str());
951
951
  }
952
952
  }
953
953
 
954
954
  static int
955
- runServer() {
955
+ runCore() {
956
956
  TRACE_POINT();
957
- P_NOTICE("Starting " AGENT_EXE " server...");
957
+ P_NOTICE("Starting " SHORT_PROGRAM_NAME " core...");
958
958
 
959
959
  try {
960
960
  UPDATE_TRACE_POINT();
@@ -992,18 +992,18 @@ runServer() {
992
992
 
993
993
  static void
994
994
  parseOptions(int argc, const char *argv[], VariantMap &options) {
995
- OptionParser p(serverUsage);
995
+ OptionParser p(coreUsage);
996
996
  int i = 2;
997
997
 
998
998
  while (i < argc) {
999
- if (parseServerOption(argc, argv, i, options)) {
999
+ if (parseCoreOption(argc, argv, i, options)) {
1000
1000
  continue;
1001
1001
  } else if (p.isFlag(argv[i], 'h', "--help")) {
1002
- serverUsage();
1002
+ coreUsage();
1003
1003
  exit(0);
1004
1004
  } else {
1005
1005
  fprintf(stderr, "ERROR: unrecognized argument %s. Please type "
1006
- "'%s server --help' for usage.\n", argv[i], argv[0]);
1006
+ "'%s core --help' for usage.\n", argv[i], argv[0]);
1007
1007
  exit(1);
1008
1008
  }
1009
1009
  }
@@ -1013,14 +1013,14 @@ static void
1013
1013
  preinitialize(VariantMap &options) {
1014
1014
  // Set log_level here so that initializeAgent() calls setLogLevel()
1015
1015
  // and setLogFile() with the right value.
1016
- if (options.has("server_log_level")) {
1017
- options.setInt("log_level", options.getInt("server_log_level"));
1016
+ if (options.has("core_log_level")) {
1017
+ options.setInt("log_level", options.getInt("core_log_level"));
1018
1018
  }
1019
- if (options.has("server_log_file")) {
1020
- options.set("log_file", options.get("server_log_file"));
1019
+ if (options.has("core_log_file")) {
1020
+ options.set("log_file", options.get("core_log_file"));
1021
1021
  }
1022
- if (options.has("server_file_descriptor_log_file")) {
1023
- options.set("file_descriptor_log_file", options.get("server_file_descriptor_log_file"));
1022
+ if (options.has("core_file_descriptor_log_file")) {
1023
+ options.set("file_descriptor_log_file", options.get("core_file_descriptor_log_file"));
1024
1024
  }
1025
1025
  }
1026
1026
 
@@ -1047,7 +1047,7 @@ setAgentsOptionsDefaults() {
1047
1047
  options.set("default_group",
1048
1048
  inferDefaultGroup(options.get("default_user")));
1049
1049
  }
1050
- options.setDefaultStrSet("server_addresses", defaultAddress);
1050
+ options.setDefaultStrSet("core_addresses", defaultAddress);
1051
1051
  options.setDefaultBool("multi_app", false);
1052
1052
  options.setDefault("environment", DEFAULT_APP_ENV);
1053
1053
  options.setDefault("spawn_method", DEFAULT_SPAWN_METHOD);
@@ -1057,6 +1057,7 @@ setAgentsOptionsDefaults() {
1057
1057
  options.setDefaultInt("max_pool_size", DEFAULT_MAX_POOL_SIZE);
1058
1058
  options.setDefaultInt("pool_idle_time", DEFAULT_POOL_IDLE_TIME);
1059
1059
  options.setDefaultInt("min_instances", 1);
1060
+ options.setDefaultInt("max_preloader_idle_time", DEFAULT_MAX_PRELOADER_IDLE_TIME);
1060
1061
  options.setDefaultInt("stat_throttle_rate", DEFAULT_STAT_THROTTLE_RATE);
1061
1062
  options.setDefault("server_software", SERVER_TOKEN_NAME "/" PASSENGER_VERSION);
1062
1063
  options.setDefaultBool("show_version_in_header", true);
@@ -1067,14 +1068,14 @@ setAgentsOptionsDefaults() {
1067
1068
  options.setDefaultUint("file_buffer_threshold", DEFAULT_FILE_BUFFERED_CHANNEL_THRESHOLD);
1068
1069
  options.setDefaultInt("response_buffer_high_watermark", DEFAULT_RESPONSE_BUFFER_HIGH_WATERMARK);
1069
1070
  options.setDefaultBool("selfchecks", false);
1070
- options.setDefaultBool("server_graceful_exit", true);
1071
- options.setDefaultInt("server_threads", boost::thread::hardware_concurrency());
1072
- options.setDefaultBool("server_cpu_affine", false);
1071
+ options.setDefaultBool("core_graceful_exit", true);
1072
+ options.setDefaultInt("core_threads", boost::thread::hardware_concurrency());
1073
+ options.setDefaultBool("core_cpu_affine", false);
1073
1074
  options.setDefault("friendly_error_pages", "auto");
1074
1075
  options.setDefaultBool("rolling_restarts", false);
1075
1076
  options.setDefaultBool("resist_deployment_errors", false);
1076
1077
 
1077
- string firstAddress = options.getStrSet("server_addresses")[0];
1078
+ string firstAddress = options.getStrSet("core_addresses")[0];
1078
1079
  if (getSocketAddressType(firstAddress) == SAT_TCP) {
1079
1080
  string host;
1080
1081
  unsigned short port;
@@ -1173,7 +1174,7 @@ sanityCheckOptions() {
1173
1174
  options.get("benchmark_mode", false).c_str());
1174
1175
  ok = false;
1175
1176
  }
1176
- if (options.getInt("server_threads") < 1) {
1177
+ if (options.getInt("core_threads") < 1) {
1177
1178
  fprintf(stderr, "ERROR: you may only specify for --threads a number greater than or equal to 1.\n");
1178
1179
  ok = false;
1179
1180
  }
@@ -1188,15 +1189,15 @@ sanityCheckOptions() {
1188
1189
  }
1189
1190
 
1190
1191
  int
1191
- serverMain(int argc, char *argv[]) {
1192
+ coreMain(int argc, char *argv[]) {
1192
1193
  int ret;
1193
1194
 
1194
1195
  agentsOptions = new VariantMap();
1195
- *agentsOptions = initializeAgent(argc, &argv, AGENT_EXE " server", parseOptions,
1196
+ *agentsOptions = initializeAgent(argc, &argv, SHORT_PROGRAM_NAME " core", parseOptions,
1196
1197
  preinitialize, 2);
1197
1198
  setAgentsOptionsDefaults();
1198
1199
  sanityCheckOptions();
1199
- ret = runServer();
1200
+ ret = runCore();
1200
1201
  shutdownAgent(agentsOptions);
1201
1202
  return ret;
1202
1203
  }