passenger 6.0.27 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +11 -1
  3. data/CONTRIBUTORS +2 -0
  4. data/bin/passenger-install-apache2-module +6 -3
  5. data/bin/passenger-install-nginx-module +8 -3
  6. data/build/support/cxx_dependency_map.rb +3 -621
  7. data/dev/index_cxx_dependencies.rb +4 -0
  8. data/package.json +1 -1
  9. data/src/agent/Core/ApplicationPool/Implementation.cpp +1 -1
  10. data/src/agent/Core/ApplicationPool/Socket.h +3 -3
  11. data/src/agent/Core/ApplicationPool/TestSession.h +3 -4
  12. data/src/agent/Core/Config.h +1 -6
  13. data/src/agent/Core/Controller/Config.h +1 -1
  14. data/src/agent/Core/CoreMain.cpp +1 -0
  15. data/src/agent/Core/SecurityUpdateChecker.h +10 -1
  16. data/src/agent/Core/SpawningKit/Exceptions.h +0 -1
  17. data/src/agent/Core/SpawningKit/Handshake/Perform.h +13 -2
  18. data/src/agent/Shared/Fundamentals/AbortHandler.cpp +23 -5
  19. data/src/agent/Shared/Fundamentals/AbortHandler.h +10 -22
  20. data/src/agent/Shared/Fundamentals/Initialization.cpp +1 -0
  21. data/src/agent/Watchdog/Config.h +1 -1
  22. data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp +5 -0
  23. data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp +5 -0
  24. data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp +14 -0
  25. data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp +3 -0
  26. data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp +3 -0
  27. data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp +11 -0
  28. data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp +7 -0
  29. data/src/apache2_module/DirConfig/AutoGeneratedStruct.h +17 -0
  30. data/src/apache2_module/Hooks.cpp +0 -6
  31. data/src/cxx_supportlib/ConfigKit/IN_PRACTICE.md +2 -12
  32. data/src/cxx_supportlib/ConfigKit/Store.h +1 -6
  33. data/src/cxx_supportlib/Constants.h +1 -1
  34. data/src/cxx_supportlib/DataStructures/StringKeyTable.h +1 -7
  35. data/src/cxx_supportlib/Exceptions.cpp +178 -0
  36. data/src/cxx_supportlib/Exceptions.h +62 -177
  37. data/src/cxx_supportlib/IOTools/IOUtils.cpp +255 -228
  38. data/src/cxx_supportlib/IOTools/IOUtils.h +84 -121
  39. data/src/cxx_supportlib/ServerKit/Config.h +1 -6
  40. data/src/cxx_supportlib/ServerKit/FileBufferedChannel.h +1 -1
  41. data/src/cxx_supportlib/StaticString.h +1 -6
  42. data/src/cxx_supportlib/Utils/Curl.h +1 -6
  43. data/src/cxx_supportlib/Utils/ScopeGuard.h +0 -32
  44. data/src/cxx_supportlib/oxt/implementation.cpp +2 -2
  45. data/src/cxx_supportlib/oxt/spin_lock.hpp +94 -23
  46. data/src/ruby_supportlib/phusion_passenger/platform_info/compiler.rb +6 -10
  47. data/src/ruby_supportlib/phusion_passenger/platform_info/cxx_portability.rb +2 -2
  48. data/src/ruby_supportlib/phusion_passenger/rack_handler.rb +2 -2
  49. data/src/ruby_supportlib/phusion_passenger.rb +1 -1
  50. metadata +3 -7
  51. data/src/cxx_supportlib/oxt/detail/spin_lock_darwin.hpp +0 -75
  52. data/src/cxx_supportlib/oxt/detail/spin_lock_gcc_x86.hpp +0 -85
  53. data/src/cxx_supportlib/oxt/detail/spin_lock_portable.hpp +0 -38
  54. data/src/cxx_supportlib/oxt/detail/spin_lock_pthreads.hpp +0 -111
@@ -43,6 +43,10 @@ EXCLUDE_NAMES = %w{
43
43
  deque
44
44
  queue
45
45
  limits
46
+ thread
47
+ atomic
48
+ mutex
49
+ condition_variable
46
50
  hash_map
47
51
  ext/hash_map
48
52
  cctype
data/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "express": "^4.19.2",
15
15
  "jquery": "^3.7.1",
16
16
  "mini-css-extract-plugin": "^2.7.6",
17
- "mocha": "^9.2.2",
17
+ "mocha": "^11.1.0",
18
18
  "multer": "^1.4.4-lts.1",
19
19
  "preact": "^8.5.3",
20
20
  "should": "^2.1.1",
@@ -193,7 +193,7 @@ void processAndLogNewSpawnException(SpawningKit::SpawnException &e, const Option
193
193
  getSystemTempDir());
194
194
  fd = mkstemp(filename);
195
195
  #endif
196
- FdGuard guard(fd, NULL, 0, true);
196
+ FdGuard guard(fd, nullptr, 0);
197
197
  if (fd == -1) {
198
198
  int e = errno;
199
199
  throw SystemException("Cannot generate a temporary filename",
@@ -89,10 +89,10 @@ private:
89
89
  Connection connect() const {
90
90
  Connection connection;
91
91
  P_TRACE(3, "Connecting to " << address);
92
- NConnect_State state(address, __FILE__, __LINE__);
93
- connection.ready = state.connectToServer();
92
+ auto result = createNonBlockingSocketConnection(address, __FILE__, __LINE__);
93
+ connection.ready = result.second;
94
94
  connection.fail = true;
95
- connection.fd = state.getFd().detach();
95
+ connection.fd = result.first;
96
96
  connection.wantKeepAlive = false;
97
97
  P_LOG_FILE_DESCRIPTOR_PURPOSE(connection.fd, "App " << pid << " connection");
98
98
  return connection;
@@ -207,10 +207,9 @@ public:
207
207
  __FILE__, __LINE__);
208
208
 
209
209
  // Create client socket (non-blocking)
210
- NUnix_State clientState;
211
- setupNonBlockingUnixSocket(clientState, socketPath, __FILE__, __LINE__);
212
- bool immediatelyConnected = connectToUnixServer(clientState);
213
- connection.first = std::move(clientState.fd);
210
+ auto nbcResult = createNonBlockingUnixSocketConnection( socketPath, __FILE__, __LINE__);
211
+ bool immediatelyConnected = nbcResult.second;
212
+ connection.first = FileDescriptor(nbcResult.first, nullptr, 0);
214
213
 
215
214
  // Accept connection (blocking)
216
215
  FileDescriptor serverSideFd(oxt::syscalls::accept(serverFd, NULL, NULL),
@@ -40,7 +40,6 @@
40
40
  #include <ConfigKit/TableTranslator.h>
41
41
  #include <ConfigKit/PrefixTranslator.h>
42
42
  #include <ServerKit/Context.h>
43
- #include <ServerKit/llversion.h>
44
43
  #include <ServerKit/HttpServer.h>
45
44
  #include <WrapperRegistry/Registry.h>
46
45
  #include <Core/Controller/Config.h>
@@ -150,7 +149,7 @@ using namespace std;
150
149
  * security_update_checker_interval unsigned integer - default(86400)
151
150
  * security_update_checker_proxy_url string - -
152
151
  * security_update_checker_url string - default("https://securitycheck.phusionpassenger.com/v1/check.json")
153
- * server_software string - default("Phusion_Passenger/6.0.27")
152
+ * server_software string - default("Phusion_Passenger/6.1.0")
154
153
  * show_version_in_header boolean - default(true)
155
154
  * single_app_mode_app_root string - default,read_only
156
155
  * single_app_mode_app_start_command string - read_only
@@ -353,10 +352,6 @@ private:
353
352
 
354
353
  Json::Value updates;
355
354
  updates["server_software"] = serverSoftware;
356
- if (effectiveValues["integration_mode"].asString() == "standalone" &&
357
- effectiveValues["standalone_engine"].asString()=="builtin") {
358
- updates["web_server_version"] = llhttp_version();
359
- }
360
355
  return updates;
361
356
  }
362
357
 
@@ -118,7 +118,7 @@ parseControllerBenchmarkMode(const StaticString &mode) {
118
118
  * old_routing boolean - default(false),read_only
119
119
  * request_freelist_limit unsigned integer - default(1024)
120
120
  * response_buffer_high_watermark unsigned integer - default(134217728)
121
- * server_software string - default("Phusion_Passenger/6.0.27")
121
+ * server_software string - default("Phusion_Passenger/6.1.0")
122
122
  * show_version_in_header boolean - default(true)
123
123
  * start_reading_after_accept boolean - default(true)
124
124
  * stat_throttle_rate unsigned integer - default(10)
@@ -88,6 +88,7 @@
88
88
  #include <Utils.h>
89
89
  #include <Utils/Timer.h>
90
90
  #include <IOTools/MessageIO.h>
91
+ #include <IOTools/IOUtils.h>
91
92
  #include <Core/OptionParser.h>
92
93
  #include <Core/Controller.h>
93
94
  #include <Core/ApiServer.h>
@@ -33,6 +33,7 @@
33
33
  #include <oxt/backtrace.hpp>
34
34
 
35
35
  #include <SecurityKit/Crypto.h>
36
+ #include <ServerKit/llversion.h>
36
37
  #include <ResourceLocator.h>
37
38
  #include <Exceptions.h>
38
39
  #include <StaticString.h>
@@ -568,7 +569,15 @@ public:
568
569
  bodyJson["passenger_version"] = PASSENGER_VERSION;
569
570
 
570
571
  bodyJson["server_integration"] = sessionState.config["server_identifier"];
571
- bodyJson["server_version"] = sessionState.config["web_server_version"];
572
+
573
+ if (bodyJson["server_integration"].asString() == "standalone" &&
574
+ sessionState.config["web_server_version"].isNull()) {
575
+ P_INFO("Config web server version was Null while using standalone integration, assuming builtin engine.");
576
+ bodyJson["server_version"] = llhttp_version();
577
+ }else {
578
+ bodyJson["server_version"] = sessionState.config["web_server_version"];
579
+ }
580
+
572
581
  bodyJson["curl_static"] = isCurlStaticallyLinked();
573
582
 
574
583
  string nonce;
@@ -28,7 +28,6 @@
28
28
 
29
29
  #include <oxt/tracable_exception.hpp>
30
30
  #include <string>
31
- #include <stdexcept>
32
31
  #include <limits>
33
32
 
34
33
  #include <Constants.h>
@@ -34,7 +34,7 @@
34
34
  #include <oxt/backtrace.hpp>
35
35
  #include <string>
36
36
  #include <vector>
37
- #include <stdexcept>
37
+ #include <exception>
38
38
  #include <cstddef>
39
39
  #include <cstdlib>
40
40
  #include <cerrno>
@@ -50,6 +50,7 @@
50
50
  #include <FileDescriptor.h>
51
51
  #include <FileTools/FileManip.h>
52
52
  #include <FileTools/PathManip.h>
53
+ #include <IOTools/IOUtils.h>
53
54
  #include <Utils.h>
54
55
  #include <Utils/ScopeGuard.h>
55
56
  #include <SystemTools/SystemTime.h>
@@ -196,8 +197,18 @@ private:
196
197
 
197
198
  while (true) {
198
199
  unsigned long long timeout = 100000;
200
+ bool pingable;
199
201
 
200
- if (pingTcpServer("127.0.0.1", session.expectedStartPort, &timeout)) {
202
+ try {
203
+ pingable = pingTcpServer("127.0.0.1", session.expectedStartPort, &timeout);
204
+ } catch (const std::exception &e) {
205
+ P_WARN("Error checking whether 127.0.0.1:" << session.expectedStartPort
206
+ << " is connectable: " << e.what());
207
+ syscalls::usleep(50000);
208
+ continue;
209
+ }
210
+
211
+ if (pingable) {
201
212
  boost::lock_guard<boost::mutex> l(syncher);
202
213
  socketIsNowPingable = true;
203
214
  finishState = FINISH_SUCCESS;
@@ -550,10 +550,10 @@ dumpFileDescriptorInfo(AbortHandlerWorkingState &state) {
550
550
  }
551
551
 
552
552
  static void
553
- dumpWithCrashWatch(AbortHandlerWorkingState &state) {
553
+ dumpWithCrashWatch(AbortHandlerWorkingState &state, bool toStderr) {
554
554
  int fd = -1;
555
555
 
556
- if (state.crashLogDirFd != -1) {
556
+ if (state.crashLogDirFd != -1 && !toStderr) {
557
557
  fd = openat(state.crashLogDirFd, "backtrace.log", O_WRONLY | O_CREAT | O_TRUNC, 0600);
558
558
  if (fd != -1) {
559
559
  printCrashLogFileCreated(state, "backtrace.log");
@@ -594,7 +594,25 @@ dumpWithCrashWatch(AbortHandlerWorkingState &state) {
594
594
  write_nowarn(STDERR_FILENO, state.messageBuf, pos - state.messageBuf);
595
595
 
596
596
  } else {
597
- waitpid(child, NULL, 0);
597
+ int status = -1;
598
+ int ret = waitpid(child, &status, 0);
599
+ int e = errno;
600
+ if (ret == -1 || status != 0) {
601
+ pos = state.messageBuf;
602
+ pos = ASSU::appendData(pos, end, "ERROR running 'crash-watch' (");
603
+ if (ret == -1) {
604
+ pos = ASSU::appendData(pos, end, "waitpid() failed, errno=");
605
+ pos = ASSU::appendInteger<int, 10>(pos, end, e);
606
+ } else if (WIFSIGNALED(status)) {
607
+ pos = ASSU::appendData(pos, end, "exited with signal ");
608
+ pos = ASSU::appendInteger<int, 10>(pos, end, WTERMSIG(status));
609
+ } else {
610
+ pos = ASSU::appendData(pos, end, "exit status ");
611
+ pos = ASSU::appendInteger<int, 10>(pos, end, WEXITSTATUS(status));
612
+ }
613
+ pos = ASSU::appendData(pos, end, ")\n");
614
+ write_nowarn(STDERR_FILENO, state.messageBuf, pos - state.messageBuf);
615
+ }
598
616
  }
599
617
 
600
618
  if (fd != -1) {
@@ -852,7 +870,7 @@ dumpDiagnostics(AbortHandlerWorkingState &state) {
852
870
  pos = ASSU::appendData(pos, end, " ] Dumping a backtrace with crash-watch...\n");
853
871
  #endif
854
872
  write_nowarn(STDERR_FILENO, state.messageBuf, pos - state.messageBuf);
855
- dumpWithCrashWatch(state);
873
+ dumpWithCrashWatch(state, ctx->config->dumpCrashWatchToStderr);
856
874
  } else {
857
875
  write_nowarn(STDERR_FILENO, "\n", 1);
858
876
  }
@@ -969,7 +987,7 @@ forkAndRedirectToTeeAndMainLogFile(const char *crashLogDir) {
969
987
  execlp("/usr/bin/cat", "cat", (char *) 0);
970
988
  ASSU::printError("ERROR: cannot execute 'tee' or 'cat'; crash log will be lost!\n");
971
989
  _exit(1);
972
- return false;
990
+ return false; // Unreachable
973
991
  } else if (pid == -1) {
974
992
  ASSU::printError("ERROR: cannot fork a process for executing 'tee'\n");
975
993
  return false;
@@ -26,8 +26,6 @@
26
26
  #ifndef _PASSENGER_AGENT_FUNDAMENTALS_ABORT_HANDLER_H_
27
27
  #define _PASSENGER_AGENT_FUNDAMENTALS_ABORT_HANDLER_H_
28
28
 
29
- #include <cstddef>
30
-
31
29
  namespace Passenger {
32
30
  class ResourceLocator;
33
31
  }
@@ -38,7 +36,7 @@ namespace Fundamentals {
38
36
 
39
37
 
40
38
  struct AbortHandlerConfig {
41
- static const unsigned int MAX_DIAGNOSTICS_DUMPERS = 5;
39
+ static constexpr unsigned int MAX_DIAGNOSTICS_DUMPERS = 5;
42
40
  typedef void (*DiagnosticsDumperFunc)(void *userData);
43
41
 
44
42
  struct DiagnosticsDumper {
@@ -56,26 +54,16 @@ struct AbortHandlerConfig {
56
54
  };
57
55
 
58
56
 
59
- char *ruby;
60
- char **origArgv;
61
- unsigned int randomSeed;
62
- bool dumpWithCrashWatch;
63
- bool beep;
64
- bool stopProcess;
65
- bool forceTerminateProcess;
66
- ResourceLocator *resourceLocator;
57
+ char *ruby = nullptr;
58
+ char **origArgv = nullptr;
59
+ unsigned int randomSeed = 0;
60
+ bool dumpWithCrashWatch = false;
61
+ bool dumpCrashWatchToStderr = false;
62
+ bool beep = false;
63
+ bool stopProcess = false;
64
+ bool forceTerminateProcess = false;
65
+ ResourceLocator *resourceLocator = nullptr;
67
66
  DiagnosticsDumper diagnosticsDumpers[MAX_DIAGNOSTICS_DUMPERS];
68
-
69
- AbortHandlerConfig()
70
- : ruby(NULL),
71
- origArgv(NULL),
72
- randomSeed(0),
73
- dumpWithCrashWatch(false),
74
- beep(false),
75
- stopProcess(false),
76
- forceTerminateProcess(false),
77
- resourceLocator(NULL)
78
- { }
79
67
  };
80
68
 
81
69
  void installAbortHandler(const AbortHandlerConfig *config);
@@ -465,6 +465,7 @@ maybeInitializeAbortHandler() {
465
465
  config->origArgv = context->origArgv;
466
466
  config->randomSeed = context->randomSeed;
467
467
  config->dumpWithCrashWatch = getEnvBool("PASSENGER_DUMP_WITH_CRASH_WATCH", true);
468
+ config->dumpCrashWatchToStderr = getEnvBool("PASSENGER_DUMP_CRASH_WATCH_TO_STDERR", false);
468
469
  config->beep = getEnvBool("PASSENGER_BEEP_ON_ABORT");
469
470
  config->stopProcess = getEnvBool("PASSENGER_STOP_ON_ABORT");
470
471
  config->forceTerminateProcess = getEnvBool("PASSENGER_FORCE_TERMINATE_ON_ABORT");
@@ -139,7 +139,7 @@ using namespace std;
139
139
  * security_update_checker_interval unsigned integer - default(86400)
140
140
  * security_update_checker_proxy_url string - -
141
141
  * security_update_checker_url string - default("https://securitycheck.phusionpassenger.com/v1/check.json")
142
- * server_software string - default("Phusion_Passenger/6.0.27")
142
+ * server_software string - default("Phusion_Passenger/6.1.0")
143
143
  * setsid boolean - default(false)
144
144
  * show_version_in_header boolean - default(true)
145
145
  * single_app_mode_app_root string - default,read_only
@@ -67,6 +67,11 @@ extern "C" const command_rec passenger_commands[] = {
67
67
  NULL,
68
68
  RSRC_CONF,
69
69
  "Use specified HTTP/SOCKS proxy for Phusion Passenger(R) anonymous telemetry collection."),
70
+ AP_INIT_TAKE1("PassengerAppConnectTimeout",
71
+ (Take1Func) cmd_passenger_app_connect_timeout,
72
+ NULL,
73
+ RSRC_CONF | ACCESS_CONF,
74
+ "A timeout for application to accept socket connections."),
70
75
  AP_INIT_TAKE1("PassengerAppEnv",
71
76
  (Take1Func) cmd_passenger_app_env,
72
77
  NULL,
@@ -159,6 +159,11 @@ void
159
159
  ConfigManifestGenerator::autoGenerated_setAppConfigDefaults() {
160
160
  Json::Value &defaultAppConfigContainer = manifest["default_application_configuration"];
161
161
 
162
+ addOptionsContainerStaticDefaultInt(
163
+ defaultAppConfigContainer,
164
+ "PassengerAppConnectTimeout",
165
+ DEFAULT_CONNECT_TIMEOUT);
166
+
162
167
  addOptionsContainerStaticDefaultStr(
163
168
  defaultAppConfigContainer,
164
169
  "PassengerAppEnv",
@@ -98,6 +98,20 @@ cmd_passenger_anonymous_telemetry_proxy(cmd_parms *cmd, void *pcfg, const char *
98
98
  return NULL;
99
99
  }
100
100
 
101
+ static const char *
102
+ cmd_passenger_app_connect_timeout(cmd_parms *cmd, void *pcfg, const char *arg) {
103
+ const char *err = ap_check_cmd_context(cmd, NOT_IN_FILES);
104
+ if (err != NULL) {
105
+ return err;
106
+ }
107
+
108
+ DirConfig *config = (DirConfig *) pcfg;
109
+ config->mAppConnectTimeoutSourceFile = cmd->directive->filename;
110
+ config->mAppConnectTimeoutSourceLine = cmd->directive->line_num;
111
+ config->mAppConnectTimeoutExplicitlySet = true;
112
+ return setIntConfig(cmd, arg, config->mAppConnectTimeout, 1);
113
+ }
114
+
101
115
  static const char *
102
116
  cmd_passenger_app_env(cmd_parms *cmd, void *pcfg, const char *arg) {
103
117
  const char *err = ap_check_cmd_context(cmd, NOT_IN_FILES);
@@ -52,6 +52,7 @@ namespace Apache2Module {
52
52
  static void
53
53
  createDirConfig_autoGenerated(DirConfig *config) {
54
54
  config->mAllowEncodedSlashes = Apache2Module::UNSET;
55
+ config->mAppConnectTimeout = UNSET_INT_VALUE;
55
56
  /*
56
57
  * config->mAppEnv: default initialized
57
58
  */
@@ -133,6 +134,7 @@ createDirConfig_autoGenerated(DirConfig *config) {
133
134
  */
134
135
 
135
136
  config->mAllowEncodedSlashesSourceLine = 0;
137
+ config->mAppConnectTimeoutSourceLine = 0;
136
138
  config->mAppEnvSourceLine = 0;
137
139
  config->mAppGroupNameSourceLine = 0;
138
140
  config->mAppLogFileSourceLine = 0;
@@ -172,6 +174,7 @@ createDirConfig_autoGenerated(DirConfig *config) {
172
174
  config->mUserSourceLine = 0;
173
175
 
174
176
  config->mAllowEncodedSlashesExplicitlySet = false;
177
+ config->mAppConnectTimeoutExplicitlySet = false;
175
178
  config->mAppEnvExplicitlySet = false;
176
179
  config->mAppGroupNameExplicitlySet = false;
177
180
  config->mAppLogFileExplicitlySet = false;
@@ -52,6 +52,9 @@ namespace Apache2Module {
52
52
 
53
53
  static void
54
54
  constructRequestHeaders_autoGenerated(request_rec *r, DirConfig *config, std::string &result) {
55
+ addHeader(r, result, StaticString("!~PASSENGER_APP_CONNECT_TIMEOUT",
56
+ sizeof("!~PASSENGER_APP_CONNECT_TIMEOUT") - 1),
57
+ config->mAppConnectTimeout);
55
58
  addHeader(result, StaticString("!~PASSENGER_APP_ENV",
56
59
  sizeof("!~PASSENGER_APP_ENV") - 1),
57
60
  config->mAppEnv);
@@ -64,6 +64,17 @@ ConfigManifestGenerator::autoGenerated_generateConfigManifestForDirConfig(server
64
64
  pdconf->mAllowEncodedSlashesSourceLine);
65
65
  hierarchyMember["value"] = pdconf->mAllowEncodedSlashes == Apache2Module::ENABLED;
66
66
  }
67
+ if (pdconf->mAppConnectTimeoutExplicitlySet) {
68
+ findOrCreateAppAndLocOptionsContainers(serverRec, csconf, cdconf,
69
+ pdconf, context, &appOptionsContainer, &locOptionsContainer);
70
+ Json::Value &optionContainer = findOrCreateOptionContainer(*appOptionsContainer,
71
+ "PassengerAppConnectTimeout",
72
+ sizeof("PassengerAppConnectTimeout") - 1);
73
+ Json::Value &hierarchyMember = addOptionContainerHierarchyMember(optionContainer,
74
+ pdconf->mAppConnectTimeoutSourceFile,
75
+ pdconf->mAppConnectTimeoutSourceLine);
76
+ hierarchyMember["value"] = pdconf->mAppConnectTimeout;
77
+ }
67
78
  if (pdconf->mAppEnvExplicitlySet) {
68
79
  findOrCreateAppAndLocOptionsContainers(serverRec, csconf, cdconf,
69
80
  pdconf, context, &appOptionsContainer, &locOptionsContainer);
@@ -52,6 +52,10 @@ mergeDirConfig_autoGenerated(DirConfig *config, DirConfig *base, DirConfig *add)
52
52
  (add->mAllowEncodedSlashes != Apache2Module::UNSET)
53
53
  ? add->mAllowEncodedSlashes
54
54
  : base->mAllowEncodedSlashes;
55
+ config->mAppConnectTimeout =
56
+ (add->mAppConnectTimeout != UNSET_INT_VALUE)
57
+ ? add->mAppConnectTimeout
58
+ : base->mAppConnectTimeout;
55
59
  config->mAppEnv =
56
60
  (!add->mAppEnv.empty())
57
61
  ? add->mAppEnv
@@ -202,6 +206,7 @@ mergeDirConfig_autoGenerated(DirConfig *config, DirConfig *base, DirConfig *add)
202
206
  : base->mUser;
203
207
 
204
208
  config->mAllowEncodedSlashesSourceFile = add->mAllowEncodedSlashesSourceFile;
209
+ config->mAppConnectTimeoutSourceFile = add->mAppConnectTimeoutSourceFile;
205
210
  config->mAppEnvSourceFile = add->mAppEnvSourceFile;
206
211
  config->mAppGroupNameSourceFile = add->mAppGroupNameSourceFile;
207
212
  config->mAppLogFileSourceFile = add->mAppLogFileSourceFile;
@@ -241,6 +246,7 @@ mergeDirConfig_autoGenerated(DirConfig *config, DirConfig *base, DirConfig *add)
241
246
  config->mUserSourceFile = add->mUserSourceFile;
242
247
 
243
248
  config->mAllowEncodedSlashesSourceLine = add->mAllowEncodedSlashesSourceLine;
249
+ config->mAppConnectTimeoutSourceLine = add->mAppConnectTimeoutSourceLine;
244
250
  config->mAppEnvSourceLine = add->mAppEnvSourceLine;
245
251
  config->mAppGroupNameSourceLine = add->mAppGroupNameSourceLine;
246
252
  config->mAppLogFileSourceLine = add->mAppLogFileSourceLine;
@@ -280,6 +286,7 @@ mergeDirConfig_autoGenerated(DirConfig *config, DirConfig *base, DirConfig *add)
280
286
  config->mUserSourceLine = add->mUserSourceLine;
281
287
 
282
288
  config->mAllowEncodedSlashesExplicitlySet = add->mAllowEncodedSlashesExplicitlySet;
289
+ config->mAppConnectTimeoutExplicitlySet = add->mAppConnectTimeoutExplicitlySet;
283
290
  config->mAppEnvExplicitlySet = add->mAppEnvExplicitlySet;
284
291
  config->mAppGroupNameExplicitlySet = add->mAppGroupNameExplicitlySet;
285
292
  config->mAppLogFileExplicitlySet = add->mAppLogFileExplicitlySet;
@@ -109,6 +109,11 @@ struct AutoGeneratedDirConfig {
109
109
  */
110
110
  Threeway mStickySessions;
111
111
 
112
+ /*
113
+ * A timeout for application to accept socket connections.
114
+ */
115
+ int mAppConnectTimeout;
116
+
112
117
  /*
113
118
  * Force Passenger to believe that an application process can handle the given number of concurrent requests per process
114
119
  */
@@ -260,6 +265,7 @@ struct AutoGeneratedDirConfig {
260
265
  StaticString mLoadShellEnvvarsSourceFile;
261
266
  StaticString mPreloadBundlerSourceFile;
262
267
  StaticString mStickySessionsSourceFile;
268
+ StaticString mAppConnectTimeoutSourceFile;
263
269
  StaticString mForceMaxConcurrentRequestsPerProcessSourceFile;
264
270
  StaticString mLveMinUidSourceFile;
265
271
  StaticString mMaxPreloaderIdleTimeSourceFile;
@@ -299,6 +305,7 @@ struct AutoGeneratedDirConfig {
299
305
  unsigned int mLoadShellEnvvarsSourceLine;
300
306
  unsigned int mPreloadBundlerSourceLine;
301
307
  unsigned int mStickySessionsSourceLine;
308
+ unsigned int mAppConnectTimeoutSourceLine;
302
309
  unsigned int mForceMaxConcurrentRequestsPerProcessSourceLine;
303
310
  unsigned int mLveMinUidSourceLine;
304
311
  unsigned int mMaxPreloaderIdleTimeSourceLine;
@@ -338,6 +345,7 @@ struct AutoGeneratedDirConfig {
338
345
  bool mLoadShellEnvvarsExplicitlySet: 1;
339
346
  bool mPreloadBundlerExplicitlySet: 1;
340
347
  bool mStickySessionsExplicitlySet: 1;
348
+ bool mAppConnectTimeoutExplicitlySet: 1;
341
349
  bool mForceMaxConcurrentRequestsPerProcessExplicitlySet: 1;
342
350
  bool mLveMinUidExplicitlySet: 1;
343
351
  bool mMaxPreloaderIdleTimeExplicitlySet: 1;
@@ -454,6 +462,15 @@ struct AutoGeneratedDirConfig {
454
462
  }
455
463
  }
456
464
 
465
+ int
466
+ getAppConnectTimeout() const {
467
+ if (mAppConnectTimeout == UNSET_INT_VALUE) {
468
+ return DEFAULT_CONNECT_TIMEOUT;
469
+ } else {
470
+ return mAppConnectTimeout;
471
+ }
472
+ }
473
+
457
474
  int
458
475
  getForceMaxConcurrentRequestsPerProcess() const {
459
476
  if (mForceMaxConcurrentRequestsPerProcess == UNSET_INT_VALUE) {
@@ -416,12 +416,6 @@ private:
416
416
  return s1.st_dev == s2.st_dev && s1.st_ino == s2.st_ino && s1.st_rdev == s2.st_rdev;
417
417
  }
418
418
 
419
- int reportBusyException(request_rec *r) {
420
- ap_custom_response(r, HTTP_SERVICE_UNAVAILABLE,
421
- "This website is too busy right now. Please try again later.");
422
- return HTTP_SERVICE_UNAVAILABLE;
423
- }
424
-
425
419
  /**
426
420
  * Gather some information about the request and do some preparations.
427
421
  *
@@ -333,12 +333,7 @@ DnsQuerier also logs its progress to a log file. This log file is opened during
333
333
  This example demonstrates caching of configuration values, and it demonstrates how to perform arbitrary operations necessary for applying a configuration change (in this case, opening a new log file and closing the previous one).
334
334
 
335
335
  ~~~c++
336
- // for std::swap()
337
- #if __cplusplus >= 201103L
338
- #include <utility>
339
- #else
340
- #include <algorithm>
341
- #endif
336
+ #include <utility>
342
337
  #include <cstdio>
343
338
  #include <cstddef>
344
339
  #include <string>
@@ -495,12 +490,7 @@ However, a subclass may not rename the parent's config options, or remove any of
495
490
  The following example demonstrates HappyDnsQuerier: a DnsQuerier subclass that prints a configurable message whenever `query()` is called.
496
491
 
497
492
  ~~~c++
498
- // for std::swap()
499
- #if __cplusplus >= 201103L
500
- #include <utility>
501
- #else
502
- #include <algorithm>
503
- #endif
493
+ #include <utility>
504
494
  #include <iostream>
505
495
  #include <boost/config.hpp>
506
496
  #include <boost/scoped_ptr.hpp>
@@ -29,12 +29,7 @@
29
29
  #include <string>
30
30
  #include <vector>
31
31
  #include <cassert>
32
- // for std::swap()
33
- #if __cplusplus >= 201103L
34
- #include <utility>
35
- #else
36
- #include <algorithm>
37
- #endif
32
+ #include <utility>
38
33
  #include <boost/config.hpp>
39
34
 
40
35
  #include <jsoncpp/json.h>
@@ -84,7 +84,7 @@
84
84
  #define PASSENGER_API_VERSION_MAJOR 0
85
85
  #define PASSENGER_API_VERSION_MINOR 3
86
86
  #define PASSENGER_DEFAULT_USER "nobody"
87
- #define PASSENGER_VERSION "6.0.27"
87
+ #define PASSENGER_VERSION "6.1.0"
88
88
  #define POOL_HELPER_THREAD_STACK_SIZE 262144
89
89
  #define PROCESS_SHUTDOWN_TIMEOUT 60
90
90
  #define PROCESS_SHUTDOWN_TIMEOUT_DISPLAY "1 minute"
@@ -29,13 +29,7 @@
29
29
  #include <boost/move/move.hpp>
30
30
  #include <boost/config.hpp>
31
31
  #include <boost/cstdint.hpp>
32
- // for std::swap()
33
- #if __cplusplus >= 201103L
34
- #include <utility>
35
- #else
36
- #include <algorithm>
37
- #endif
38
- #include <limits>
32
+ #include <utility>
39
33
  #include <cstring>
40
34
  #include <cassert>
41
35
  #include <cstddef>