passenger 6.0.1 → 6.0.2

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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +21 -0
  3. data/CONTRIBUTORS +3 -0
  4. data/bin/passenger-status +15 -0
  5. data/build/misc.rb +3 -1
  6. data/resources/templates/standalone/http.erb +1 -0
  7. data/src/agent/Core/Config.h +1 -1
  8. data/src/agent/Core/Controller/Config.h +1 -1
  9. data/src/agent/Core/CoreMain.cpp +1 -1
  10. data/src/agent/Watchdog/Config.h +1 -1
  11. data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp +5 -0
  12. data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp +5 -0
  13. data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp +15 -0
  14. data/src/apache2_module/Hooks.cpp +1 -0
  15. data/src/apache2_module/ServerConfig/AutoGeneratedManifestGeneration.cpp +9 -0
  16. data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h +11 -0
  17. data/src/cxx_supportlib/Constants.h +1 -1
  18. data/src/cxx_supportlib/LoggingKit/Config.h +1 -0
  19. data/src/cxx_supportlib/LoggingKit/Implementation.cpp +15 -9
  20. data/src/cxx_supportlib/SystemTools/ContainerHelpers.h +20 -19
  21. data/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c +8 -0
  22. data/src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c +6 -0
  23. data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c +12 -0
  24. data/src/nginx_module/Configuration.c +0 -9
  25. data/src/nginx_module/MainConfig/AutoGeneratedCreateFunction.c +5 -0
  26. data/src/nginx_module/MainConfig/AutoGeneratedManifestGeneration.c +11 -0
  27. data/src/nginx_module/MainConfig/AutoGeneratedStruct.h +4 -0
  28. data/src/nginx_module/ngx_http_passenger_module.c +1 -0
  29. data/src/ruby_native_extension/extconf.rb +7 -0
  30. data/src/ruby_supportlib/phusion_passenger.rb +1 -1
  31. data/src/ruby_supportlib/phusion_passenger/admin_tools/instance_registry.rb +8 -0
  32. data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +7 -0
  33. data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +8 -0
  34. data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +5 -0
  35. data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +1 -0
  36. data/src/ruby_supportlib/phusion_passenger/utils/tee_input.rb +6 -0
  37. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d32b7b733ff8e0ad7bbfba5e03e4550f5688c991
4
- data.tar.gz: 9fd2550bd78fdbd5a7d40ebee8e41cd0fe748a3d
3
+ metadata.gz: '0619ca90cabc94ee6b8801d143b14877ab15500d'
4
+ data.tar.gz: f65f9070719053192fcc50206cb146cd18dbba2f
5
5
  SHA512:
6
- metadata.gz: 353d24ed6888fc0eb1aa81308a7d81390f87e8b51c67ae384b68982cc4cc493d3a3129dc53087c17459e69c8b641728c03a8033f1b2ca8aef653c0dfdd001858
7
- data.tar.gz: 1a9d27b7d986f2249bc5536b0002ec17b5c0c2b1f9d638d1ccd144dc3079398ecc1b2b773ba79d2c5ed66a8a95fba8fafd77981b44fca338f463396ef7970fde
6
+ metadata.gz: 9e844139554498a4662950e649dcf56b768bc74f9a306ef070d13fa504e2f18869e701fd8ceb064aaba5bb4987277ee9910f8aaf2ec8135f60823645895a1965
7
+ data.tar.gz: 8b0bc8083d5a620506813ae1946fc900e3ae65016fcd552a5c8ea6273d0cf247482d676146eb889fa776b1059e91d4dc51249c9aa7a2c070120f2d9458e32992
data/CHANGELOG CHANGED
@@ -1,3 +1,24 @@
1
+ Release 6.0.2
2
+ -------------
3
+
4
+ * Allow compilation to work when Apple messed up their system ruby headers.
5
+ * Only try to read pid 1's /proc files as root, in container detection. Closes GH-2168.
6
+ * Add an option to disable prefixing application logs with "App PID stdout": `PassengerDisableLogPrefix` (Apache) / `passenger_disable_log_prefix` (Nginx). Closes GH-1915.
7
+ * Add support for identifying the Passenger instance by PID. Closes GH-2146. Contributed by Saverio Miroddi (@saveriomiroddi).
8
+ * [Ruby] Made Passenger more resiliant to Rack bugs. Closes GH-2150.
9
+ * [Nginx] Do not touch Nginx's proxy_temp_path var in Passenger's nginx modules. Closes GH-2075. Contributed by Roman Berestnikov-Sivolov (@ROMB).
10
+ * Updated Ruby versions used in precompiled binaries (used for e.g. gem installs) to include 2.6.1.
11
+ * Updated various library versions used in precompiled binaries (used for e.g. gem installs):
12
+
13
+ - Curl: 7.64.0 (was: 7.63.0)
14
+ - Ruby: 2.6.1 (was: 2.6.0)
15
+ - RubyGems 3.0.2 (was: 3.0.1)
16
+ - ccache 3.6 (was: 3.5)
17
+ - GnuPG 2.2.13 (was: 2.2.12)
18
+ - libassuan 2.5.3 (was: 2.5.2)
19
+ - libgpg_error 1.35 (was: 1.33)
20
+
21
+
1
22
  Release 6.0.1
2
23
  -------------
3
24
 
@@ -40,6 +40,7 @@ Gokulnath Manakkattil
40
40
  Gregory Potamianos
41
41
  Hongli Lai (Phusion)
42
42
  Ian Ehlert
43
+ Ian Kottman
43
44
  Igor Vuk
44
45
  isaac
45
46
  Isaac Reuben
@@ -87,11 +88,13 @@ Richard Michael
87
88
  Rob Paisley
88
89
  Robin Bowes
89
90
  Romain Tartière
91
+ ROMB
90
92
  Ruslan Ermilov (NGINX Inc)
91
93
  Ryan Schwartz
92
94
  Ryo Onodera
93
95
  Saimon Moore
94
96
  Sam Pohlenz
97
+ Saverio Miroddi
95
98
  Sean Wilkinson
96
99
  Sebastian Delmont
97
100
  Sebastian Welther
@@ -55,6 +55,8 @@ DEFAULT_OPTIONS = { :show => 'pool', :color => STDOUT.tty? }.freeze
55
55
  def command_show_status(argv, options)
56
56
  if argv.empty?
57
57
  instance = find_sole_instance
58
+ elsif options[:pid_identifier]
59
+ instance = find_instance_by_watchdog_pid(argv[0].to_i)
58
60
  else
59
61
  instance = find_instance_by_name_prefix(argv[0])
60
62
  end
@@ -100,6 +102,16 @@ def find_instance_by_name_prefix(name)
100
102
  end
101
103
  end
102
104
 
105
+ def find_instance_by_watchdog_pid(pid)
106
+ instance = InstanceRegistry.new.find_by_watchdog_pid(pid)
107
+
108
+ if instance
109
+ return instance
110
+ else
111
+ abort "ERROR: there doesn't seem to be a #{PROGRAM_NAME} instance running with the pid #{pid}."
112
+ end
113
+ end
114
+
103
115
  def show_status(instance, options)
104
116
  # if the noshow override is not specified, the default is to show the header, unless show=xml
105
117
  if options[:noheader] != true && options[:show] != 'xml'
@@ -292,6 +304,9 @@ def create_option_parser(options)
292
304
  opts.on("--force-colors", "Display colors even if stdout is not a TTY") do
293
305
  options[:color] = true
294
306
  end
307
+ opts.on("--pid-identifier", "Identify instance by [Watchdog] PID, rather than name.") do
308
+ options[:pid_identifier] = true
309
+ end
295
310
  opts.on("--verbose", "-v", "Show verbose information.") do
296
311
  options[:verbose] = true
297
312
  end
@@ -143,6 +143,8 @@ task :contributors do
143
143
  entries.push "Floor Drees (Phusion)"
144
144
  entries.delete "Luuk Hafkamp"
145
145
  entries.push "Luuk Hafkamp (Phusion)"
146
+ entries.delete "Luuk Hendriks"
147
+ entries.push "Luuk Hendriks (Phusion)"
146
148
 
147
149
  # Non-employee contributors
148
150
  entries.push "Ruslan Ermilov (NGINX Inc)"
@@ -152,7 +154,7 @@ task :contributors do
152
154
  entries.push "Yichun Zhang"
153
155
 
154
156
  File.open("CONTRIBUTORS", "w") do |f|
155
- f.puts(entries.sort{ |a, b| a.downcase <=> b.downcase }.join("\n"))
157
+ f.puts(entries.sort{ |a, b| a.downcase <=> b.downcase }.uniq.join("\n"))
156
158
  end
157
159
  puts "Updated CONTRIBUTORS"
158
160
  end
@@ -27,6 +27,7 @@ passenger_user_switching off;
27
27
  <%= nginx_http_option(:python) %>
28
28
  <%= nginx_http_option(:nodejs) %>
29
29
  <%= nginx_http_option(:log_level) %>
30
+ <%= nginx_http_option(:disable_log_prefix) %>
30
31
  <%= nginx_http_option(:max_pool_size) %>
31
32
  <%= nginx_http_option(:pool_idle_time) %>
32
33
  <%= nginx_http_option(:max_preloader_idle_time) %>
@@ -157,7 +157,7 @@ using namespace std;
157
157
  * security_update_checker_interval unsigned integer - default(86400)
158
158
  * security_update_checker_proxy_url string - -
159
159
  * security_update_checker_url string - default("https://securitycheck.phusionpassenger.com/v1/check.json")
160
- * server_software string - default("Phusion_Passenger/6.0.1")
160
+ * server_software string - default("Phusion_Passenger/6.0.2")
161
161
  * show_version_in_header boolean - default(true)
162
162
  * single_app_mode_app_root string - default,read_only
163
163
  * single_app_mode_app_start_command string - read_only
@@ -113,7 +113,7 @@ parseControllerBenchmarkMode(const StaticString &mode) {
113
113
  * multi_app boolean - default(true),read_only
114
114
  * request_freelist_limit unsigned integer - default(1024)
115
115
  * response_buffer_high_watermark unsigned integer - default(134217728)
116
- * server_software string - default("Phusion_Passenger/6.0.1")
116
+ * server_software string - default("Phusion_Passenger/6.0.2")
117
117
  * show_version_in_header boolean - default(true)
118
118
  * start_reading_after_accept boolean - default(true)
119
119
  * stat_throttle_rate unsigned integer - default(10)
@@ -912,7 +912,7 @@ initializeAdminPanelConnector() {
912
912
  TRACE_POINT();
913
913
  WorkingObjects &wo = *workingObjects;
914
914
 
915
- if (coreConfig->get("admin_panel_url").isNull()) {
915
+ if (coreConfig->get("admin_panel_url").empty()) {
916
916
  return;
917
917
  }
918
918
 
@@ -146,7 +146,7 @@ using namespace std;
146
146
  * security_update_checker_interval unsigned integer - default(86400)
147
147
  * security_update_checker_proxy_url string - -
148
148
  * security_update_checker_url string - default("https://securitycheck.phusionpassenger.com/v1/check.json")
149
- * server_software string - default("Phusion_Passenger/6.0.1")
149
+ * server_software string - default("Phusion_Passenger/6.0.2")
150
150
  * setsid boolean - default(false)
151
151
  * show_version_in_header boolean - default(true)
152
152
  * single_app_mode_app_root string - default,read_only
@@ -177,6 +177,11 @@ extern "C" const command_rec passenger_commands[] = {
177
177
  NULL,
178
178
  RSRC_CONF,
179
179
  "Whether to disable Phusion Passenger anonymous telemetry."),
180
+ AP_INIT_FLAG("PassengerDisableLogPrefix",
181
+ (FlagFunc) cmd_passenger_disable_log_prefix,
182
+ NULL,
183
+ RSRC_CONF,
184
+ "Disable prefixing log statements with PID and channel."),
180
185
  AP_INIT_FLAG("PassengerDisableSecurityUpdateCheck",
181
186
  (FlagFunc) cmd_passenger_disable_security_update_check,
182
187
  NULL,
@@ -73,6 +73,11 @@ ConfigManifestGenerator::autoGenerated_setGlobalConfigDefaults() {
73
73
  "PassengerDisableAnonymousTelemetry",
74
74
  false);
75
75
 
76
+ addOptionsContainerStaticDefaultBool(
77
+ globalConfigContainer,
78
+ "PassengerDisableLogPrefix",
79
+ false);
80
+
76
81
  addOptionsContainerStaticDefaultBool(
77
82
  globalConfigContainer,
78
83
  "PassengerDisableSecurityUpdateCheck",
@@ -334,6 +334,21 @@ cmd_passenger_disable_anonymous_telemetry(cmd_parms *cmd, void *pcfg, const char
334
334
  return NULL;
335
335
  }
336
336
 
337
+ static const char *
338
+ cmd_passenger_disable_log_prefix(cmd_parms *cmd, void *pcfg, const char *arg) {
339
+ const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
340
+ if (err != NULL) {
341
+ ap_log_perror(APLOG_MARK, APLOG_STARTUP, 0, cmd->temp_pool,
342
+ "WARNING: %s", err);
343
+ }
344
+
345
+ serverConfig.disableLogPrefixSourceFile = cmd->directive->filename;
346
+ serverConfig.disableLogPrefixSourceLine = cmd->directive->line_num;
347
+ serverConfig.disableLogPrefixExplicitlySet = true;
348
+ serverConfig.disableLogPrefix = arg != NULL;
349
+ return NULL;
350
+ }
351
+
337
352
  static const char *
338
353
  cmd_passenger_disable_security_update_check(cmd_parms *cmd, void *pcfg, const char *arg) {
339
354
  const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
@@ -1354,6 +1354,7 @@ public:
1354
1354
  config["admin_panel_auth_type"] = nonEmptyString(serverConfig.adminPanelAuthType);
1355
1355
  config["admin_panel_username"] = nonEmptyString(serverConfig.adminPanelUsername);
1356
1356
  config["admin_panel_password"] = nonEmptyString(serverConfig.adminPanelPassword);
1357
+ config["disable_log_prefix"] = serverConfig.disableLogPrefix;
1357
1358
 
1358
1359
  if (!serverConfig.logFile.empty()) {
1359
1360
  config["log_target"] = serverConfig.logFile.toString();
@@ -155,6 +155,15 @@ ConfigManifestGenerator::autoGenerated_generateConfigManifestForServerConfig() {
155
155
  serverConfig.disableAnonymousTelemetrySourceLine);
156
156
  hierarchyMember["value"] = serverConfig.disableAnonymousTelemetry == Apache2Module::ENABLED;
157
157
  }
158
+ if (serverConfig.disableLogPrefixExplicitlySet) {
159
+ Json::Value &optionContainer = findOrCreateOptionContainer(globalOptionsContainer,
160
+ "PassengerDisableLogPrefix",
161
+ sizeof("PassengerDisableLogPrefix") - 1);
162
+ Json::Value &hierarchyMember = addOptionContainerHierarchyMember(optionContainer,
163
+ serverConfig.disableLogPrefixSourceFile,
164
+ serverConfig.disableLogPrefixSourceLine);
165
+ hierarchyMember["value"] = serverConfig.disableLogPrefix == Apache2Module::ENABLED;
166
+ }
158
167
  if (serverConfig.disableSecurityUpdateCheckExplicitlySet) {
159
168
  Json::Value &optionContainer = findOrCreateOptionContainer(globalOptionsContainer,
160
169
  "PassengerDisableSecurityUpdateCheck",
@@ -62,6 +62,11 @@ struct AutoGeneratedServerConfig {
62
62
  */
63
63
  bool disableAnonymousTelemetry;
64
64
 
65
+ /*
66
+ * Disable prefixing log statements with PID and channel.
67
+ */
68
+ bool disableLogPrefix;
69
+
65
70
  /*
66
71
  * Whether to disable the Phusion Passenger security update check & notification.
67
72
  */
@@ -199,6 +204,7 @@ struct AutoGeneratedServerConfig {
199
204
 
200
205
 
201
206
  StaticString disableAnonymousTelemetrySourceFile;
207
+ StaticString disableLogPrefixSourceFile;
202
208
  StaticString disableSecurityUpdateCheckSourceFile;
203
209
  StaticString showVersionInHeaderSourceFile;
204
210
  StaticString turbocachingSourceFile;
@@ -228,6 +234,7 @@ struct AutoGeneratedServerConfig {
228
234
  StaticString prestartURLsSourceFile;
229
235
 
230
236
  unsigned int disableAnonymousTelemetrySourceLine;
237
+ unsigned int disableLogPrefixSourceLine;
231
238
  unsigned int disableSecurityUpdateCheckSourceLine;
232
239
  unsigned int showVersionInHeaderSourceLine;
233
240
  unsigned int turbocachingSourceLine;
@@ -257,6 +264,7 @@ struct AutoGeneratedServerConfig {
257
264
  unsigned int prestartURLsSourceLine;
258
265
 
259
266
  bool disableAnonymousTelemetryExplicitlySet: 1;
267
+ bool disableLogPrefixExplicitlySet: 1;
260
268
  bool disableSecurityUpdateCheckExplicitlySet: 1;
261
269
  bool showVersionInHeaderExplicitlySet: 1;
262
270
  bool turbocachingExplicitlySet: 1;
@@ -288,6 +296,7 @@ struct AutoGeneratedServerConfig {
288
296
 
289
297
  AutoGeneratedServerConfig() {
290
298
  disableAnonymousTelemetry = false;
299
+ disableLogPrefix = false;
291
300
  disableSecurityUpdateCheck = false;
292
301
  showVersionInHeader = true;
293
302
  turbocaching = true;
@@ -345,6 +354,7 @@ struct AutoGeneratedServerConfig {
345
354
  */
346
355
 
347
356
  disableAnonymousTelemetrySourceLine = 0;
357
+ disableLogPrefixSourceLine = 0;
348
358
  disableSecurityUpdateCheckSourceLine = 0;
349
359
  showVersionInHeaderSourceLine = 0;
350
360
  turbocachingSourceLine = 0;
@@ -374,6 +384,7 @@ struct AutoGeneratedServerConfig {
374
384
  prestartURLsSourceLine = 0;
375
385
 
376
386
  disableAnonymousTelemetryExplicitlySet = false;
387
+ disableLogPrefixExplicitlySet = false;
377
388
  disableSecurityUpdateCheckExplicitlySet = false;
378
389
  showVersionInHeaderExplicitlySet = false;
379
390
  turbocachingExplicitlySet = false;
@@ -81,7 +81,7 @@
81
81
  #define PASSENGER_API_VERSION_MAJOR 0
82
82
  #define PASSENGER_API_VERSION_MINOR 3
83
83
  #define PASSENGER_DEFAULT_USER "nobody"
84
- #define PASSENGER_VERSION "6.0.1"
84
+ #define PASSENGER_VERSION "6.0.2"
85
85
  #define POOL_HELPER_THREAD_STACK_SIZE 262144
86
86
  #define PROCESS_SHUTDOWN_TIMEOUT 60
87
87
  #define PROCESS_SHUTDOWN_TIMEOUT_DISPLAY "1 minute"
@@ -88,6 +88,7 @@ struct ConfigRealization {
88
88
  FdClosePolicy targetFdClosePolicy;
89
89
  FdClosePolicy fileDescriptorLogTargetFdClosePolicy;
90
90
  bool finalized;
91
+ bool disableLogPrefix;
91
92
 
92
93
  ConfigRealization(const ConfigKit::Store &store);
93
94
  ~ConfigRealization();
@@ -409,16 +409,18 @@ realLogAppOutput(const HashedStaticString &groupName, int targetFd,
409
409
  const char *pidStr, unsigned int pidStrLen,
410
410
  const char *channelName, unsigned int channelNameLen,
411
411
  const char *message, unsigned int messageLen, int appLogFile,
412
- bool saveLog)
412
+ bool saveLog, bool prefixLogs)
413
413
  {
414
414
  char *pos = buf;
415
415
  char *end = buf + bufSize;
416
416
 
417
- pos = appendData(pos, end, "App ");
418
- pos = appendData(pos, end, pidStr, pidStrLen);
419
- pos = appendData(pos, end, " ");
420
- pos = appendData(pos, end, channelName, channelNameLen);
421
- pos = appendData(pos, end, ": ");
417
+ if (prefixLogs) {
418
+ pos = appendData(pos, end, "App ");
419
+ pos = appendData(pos, end, pidStr, pidStrLen);
420
+ pos = appendData(pos, end, " ");
421
+ pos = appendData(pos, end, channelName, channelNameLen);
422
+ pos = appendData(pos, end, ": ");
423
+ }
422
424
  pos = appendData(pos, end, message, messageLen);
423
425
  pos = appendData(pos, end, "\n");
424
426
 
@@ -437,6 +439,7 @@ logAppOutput(const HashedStaticString &groupName, pid_t pid, const StaticString
437
439
  {
438
440
  int targetFd;
439
441
  bool saveLog = false;
442
+ bool prefixLogs = true;
440
443
 
441
444
  if (OXT_LIKELY(context != NULL)) {
442
445
  const ConfigRealization *configRealization = context->getConfigRealization();
@@ -446,6 +449,7 @@ logAppOutput(const HashedStaticString &groupName, pid_t pid, const StaticString
446
449
 
447
450
  targetFd = configRealization->targetFd;
448
451
  saveLog = configRealization->saveLog;
452
+ prefixLogs = !configRealization->disableLogPrefix;
449
453
  } else {
450
454
  targetFd = STDERR_FILENO;
451
455
  }
@@ -476,14 +480,14 @@ logAppOutput(const HashedStaticString &groupName, pid_t pid, const StaticString
476
480
  buf, sizeof(buf),
477
481
  pidStr, pidStrLen,
478
482
  channelName.data(), channelName.size(),
479
- message, size, fd, saveLog);
483
+ message, size, fd, saveLog, prefixLogs);
480
484
  } else {
481
485
  DynamicBuffer buf(totalLen);
482
486
  realLogAppOutput(groupName, targetFd,
483
487
  buf.data, totalLen,
484
488
  pidStr, pidStrLen,
485
489
  channelName.data(), channelName.size(),
486
- message, size, fd, saveLog);
490
+ message, size, fd, saveLog, prefixLogs);
487
491
  }
488
492
  if(fd > -1){close(fd);}
489
493
  }
@@ -778,6 +782,7 @@ Schema::Schema() {
778
782
  add("redirect_stderr", BOOL_TYPE, OPTIONAL, true);
779
783
  add("app_output_log_level", STRING_TYPE, OPTIONAL, DEFAULT_APP_OUTPUT_LOG_LEVEL_NAME);
780
784
  add("buffer_logs", BOOL_TYPE, OPTIONAL, false);
785
+ add("disable_log_prefix", BOOL_TYPE, OPTIONAL, false);
781
786
 
782
787
  addValidator(boost::bind(validateLogLevel, "level",
783
788
  boost::placeholders::_1, boost::placeholders::_2));
@@ -798,7 +803,8 @@ ConfigRealization::ConfigRealization(const ConfigKit::Store &store)
798
803
  : level(parseLevel(store["level"].asString())),
799
804
  appOutputLogLevel(parseLevel(store["app_output_log_level"].asString())),
800
805
  saveLog(store["buffer_logs"].asBool()),
801
- finalized(false)
806
+ finalized(false),
807
+ disableLogPrefix(store["disable_log_prefix"].asBool())
802
808
  {
803
809
  if (store["target"].isMember("stderr")) {
804
810
  targetType = STDERR_TARGET;
@@ -43,33 +43,34 @@ _linuxAutoDetectInContainer() {
43
43
  return (file.length() > 0);
44
44
  }
45
45
 
46
- if (fileExists("/proc/1/environ")) {
47
- string file = unsafeReadFile("/proc/1/environ");
48
- if (file.size() > 0) {
49
- vector<string> v;
50
- split(file,'\0', v);
51
- for(vector<string>::iterator it = v.begin(); it != v.end(); ++it) {
52
- if (startsWith(*it, "container=")) {
53
- return true;
46
+ if (getuid() == 0) {
47
+ if (fileExists("/proc/1/environ")) {
48
+ string file = unsafeReadFile("/proc/1/environ");
49
+ if (file.size() > 0) {
50
+ vector<string> v;
51
+ split(file,'\0', v);
52
+ for(vector<string>::iterator it = v.begin(); it != v.end(); ++it) {
53
+ if (startsWith(*it, "container=")) {
54
+ return true;
55
+ }
54
56
  }
55
57
  }
56
58
  }
57
- }
58
59
 
59
- if (fileExists("/proc/1/sched")) {
60
- string file = unsafeReadFile("/proc/1/sched");
61
- if (file.length() >= 0) {
62
- const char t = file[0];
63
- if (t == '\0') {
64
- return false;
65
- }
60
+ if (fileExists("/proc/1/sched")) {
61
+ string file = unsafeReadFile("/proc/1/sched");
62
+ if (file.length() >= 0) {
63
+ const char t = file[0];
64
+ if (t == '\0') {
65
+ return false;
66
+ }
66
67
 
67
- if (!startsWith(file, "(1,")) {
68
- return true;
68
+ if (!startsWith(file, "(1,")) {
69
+ return true;
70
+ }
69
71
  }
70
72
  }
71
73
  }
72
-
73
74
  return false;
74
75
  }
75
76
 
@@ -86,6 +86,14 @@
86
86
  offsetof(passenger_main_conf_t, autogenerated.log_file),
87
87
  NULL
88
88
  },
89
+ {
90
+ ngx_string("passenger_disable_log_prefix"),
91
+ NGX_HTTP_MAIN_CONF | NGX_CONF_FLAG,
92
+ passenger_conf_set_disable_log_prefix,
93
+ NGX_HTTP_MAIN_CONF_OFFSET,
94
+ offsetof(passenger_main_conf_t, autogenerated.disable_log_prefix),
95
+ NULL
96
+ },
89
97
  {
90
98
  ngx_string("passenger_file_descriptor_log_file"),
91
99
  NGX_HTTP_MAIN_CONF | NGX_CONF_TAKE1,
@@ -61,6 +61,12 @@ set_manifest_autogenerated_global_conf_defaults(manifest_gen_ctx_t *ctx) {
61
61
  "Nginx's global error log",
62
62
  sizeof("Nginx's global error log") - 1);
63
63
 
64
+ add_manifest_options_container_static_default_bool(ctx,
65
+ ctx->global_config_container,
66
+ "passenger_disable_log_prefix",
67
+ sizeof("passenger_disable_log_prefix") - 1,
68
+ 0);
69
+
64
70
  add_manifest_options_container_dynamic_default(ctx,
65
71
  ctx->global_config_container,
66
72
  "passenger_data_buffer_dir",
@@ -145,6 +145,18 @@ passenger_conf_set_log_file(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) {
145
145
  return ngx_conf_set_str_slot(cf, cmd, conf);
146
146
  }
147
147
 
148
+ static char *
149
+ passenger_conf_set_disable_log_prefix(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) {
150
+ passenger_main_conf_t *passenger_conf = conf;
151
+
152
+ passenger_conf->autogenerated.disable_log_prefix_explicitly_set = 1;
153
+ record_main_conf_source_location(cf,
154
+ &passenger_conf->autogenerated.disable_log_prefix_source_file,
155
+ &passenger_conf->autogenerated.disable_log_prefix_source_line);
156
+
157
+ return ngx_conf_set_flag_slot(cf, cmd, conf);
158
+ }
159
+
148
160
  static char *
149
161
  passenger_conf_set_file_descriptor_log_file(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) {
150
162
  passenger_main_conf_t *passenger_conf = conf;
@@ -61,10 +61,6 @@ static ngx_str_t headers_to_hide[] = {
61
61
 
62
62
  passenger_main_conf_t passenger_main_conf;
63
63
 
64
- static ngx_path_init_t ngx_http_proxy_temp_path = {
65
- ngx_string(NGX_HTTP_PROXY_TEMP_PATH), { 1, 2, 0 }
66
- };
67
-
68
64
 
69
65
  static ngx_int_t merge_headers(ngx_conf_t *cf, passenger_loc_conf_t *conf,
70
66
  passenger_loc_conf_t *prev);
@@ -577,11 +573,6 @@ passenger_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
577
573
  |NGX_HTTP_UPSTREAM_FT_OFF;
578
574
  }
579
575
 
580
- ngx_conf_merge_path_value(cf,
581
- &conf->upstream_config.temp_path,
582
- prev->upstream_config.temp_path,
583
- &ngx_http_proxy_temp_path);
584
-
585
576
  #if (NGX_HTTP_CACHE)
586
577
 
587
578
  #if NGINX_VERSION_NUM >= 1007009
@@ -49,6 +49,7 @@ passenger_create_autogenerated_main_conf(passenger_autogenerated_main_conf_t *co
49
49
  conf->log_level = NGX_CONF_UNSET_UINT;
50
50
  conf->log_file.data = NULL;
51
51
  conf->log_file.len = 0;
52
+ conf->disable_log_prefix = NGX_CONF_UNSET;
52
53
  conf->file_descriptor_log_file.data = NULL;
53
54
  conf->file_descriptor_log_file.len = 0;
54
55
  conf->data_buffer_dir.data = NULL;
@@ -110,6 +111,10 @@ passenger_create_autogenerated_main_conf(passenger_autogenerated_main_conf_t *co
110
111
  conf->log_file_source_file.len = 0;
111
112
  conf->log_file_source_line = 0;
112
113
  conf->log_file_explicitly_set = 0;
114
+ conf->disable_log_prefix_source_file.data = NULL;
115
+ conf->disable_log_prefix_source_file.len = 0;
116
+ conf->disable_log_prefix_source_line = 0;
117
+ conf->disable_log_prefix_explicitly_set = 0;
113
118
  conf->file_descriptor_log_file_source_file.data = NULL;
114
119
  conf->file_descriptor_log_file_source_file.len = 0;
115
120
  conf->file_descriptor_log_file_source_line = 0;
@@ -113,6 +113,17 @@ generate_config_manifest_for_autogenerated_main_conf(manifest_gen_ctx_t *ctx, pa
113
113
  (const char *) conf->autogenerated.log_file.data,
114
114
  conf->autogenerated.log_file.len);
115
115
  }
116
+ if (conf->autogenerated.disable_log_prefix_explicitly_set) {
117
+ option_container = find_or_create_manifest_option_container(ctx,
118
+ ctx->global_config_container,
119
+ "passenger_disable_log_prefix",
120
+ sizeof("passenger_disable_log_prefix") - 1);
121
+ hierarchy_member = add_manifest_option_container_hierarchy_member(option_container,
122
+ &conf->autogenerated.disable_log_prefix_source_file,
123
+ conf->autogenerated.disable_log_prefix_source_line);
124
+ psg_json_value_set_bool(hierarchy_member, "value",
125
+ conf->autogenerated.disable_log_prefix);
126
+ }
116
127
  if (conf->autogenerated.file_descriptor_log_file_explicitly_set) {
117
128
  option_container = find_or_create_manifest_option_container(ctx,
118
129
  ctx->global_config_container,
@@ -44,6 +44,7 @@ typedef struct {
44
44
  ngx_uint_t core_file_descriptor_ulimit;
45
45
  ngx_array_t *ctl;
46
46
  ngx_flag_t disable_anonymous_telemetry;
47
+ ngx_flag_t disable_log_prefix;
47
48
  ngx_flag_t disable_security_update_check;
48
49
  ngx_uint_t log_level;
49
50
  ngx_uint_t max_instances_per_app;
@@ -84,6 +85,7 @@ typedef struct {
84
85
  ngx_str_t default_group_source_file;
85
86
  ngx_str_t default_user_source_file;
86
87
  ngx_str_t disable_anonymous_telemetry_source_file;
88
+ ngx_str_t disable_log_prefix_source_file;
87
89
  ngx_str_t disable_security_update_check_source_file;
88
90
  ngx_str_t dump_config_manifest_source_file;
89
91
  ngx_str_t file_descriptor_log_file_source_file;
@@ -116,6 +118,7 @@ typedef struct {
116
118
  ngx_uint_t default_group_source_line;
117
119
  ngx_uint_t default_user_source_line;
118
120
  ngx_uint_t disable_anonymous_telemetry_source_line;
121
+ ngx_uint_t disable_log_prefix_source_line;
119
122
  ngx_uint_t disable_security_update_check_source_line;
120
123
  ngx_uint_t dump_config_manifest_source_line;
121
124
  ngx_uint_t file_descriptor_log_file_source_line;
@@ -148,6 +151,7 @@ typedef struct {
148
151
  ngx_int_t default_group_explicitly_set;
149
152
  ngx_int_t default_user_explicitly_set;
150
153
  ngx_int_t disable_anonymous_telemetry_explicitly_set;
154
+ ngx_int_t disable_log_prefix_explicitly_set;
151
155
  ngx_int_t disable_security_update_check_explicitly_set;
152
156
  ngx_int_t dump_config_manifest_explicitly_set;
153
157
  ngx_int_t file_descriptor_log_file_explicitly_set;
@@ -362,6 +362,7 @@ start_watchdog(ngx_cycle_t *cycle) {
362
362
  psg_json_value_set_value (w_config, "config_manifest", -1, passenger_main_conf.manifest);
363
363
  psg_json_value_set_ngx_uint (w_config, "log_level", autogenerated_main_conf->log_level);
364
364
  psg_json_value_set_ngx_str_ne(w_config, "file_descriptor_log_target", &autogenerated_main_conf->file_descriptor_log_file);
365
+ psg_json_value_set_ngx_flag (w_config, "disable_log_prefix", autogenerated_main_conf->disable_log_prefix);
365
366
  psg_json_value_set_ngx_uint (w_config, "core_file_descriptor_ulimit", autogenerated_main_conf->core_file_descriptor_ulimit);
366
367
  psg_json_value_set_ngx_uint (w_config, "controller_socket_backlog", autogenerated_main_conf->socket_backlog);
367
368
  psg_json_value_set_ngx_str_ne(w_config, "controller_file_buffered_channel_buffer_dir", &autogenerated_main_conf->data_buffer_dir);
@@ -21,6 +21,13 @@
21
21
  # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
22
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
23
  # THE SOFTWARE.
24
+
25
+ # Apple has a habit of getting their Ruby headers wrong, so if we are building using system ruby we need to patch things up, sierra & mojave both did this.
26
+ # eg https://openradar.appspot.com/46465917
27
+ if RUBY_PLATFORM =~ /darwin/ && !File.exists?(RbConfig::CONFIG["rubyarchhdrdir"])
28
+ RbConfig::CONFIG["rubyarchhdrdir"].sub!(RUBY_PLATFORM.split('-').last, Dir.entries(File.dirname(RbConfig::CONFIG["rubyarchhdrdir"])).reject{|d|d.start_with?(".","ruby")}.first.split('-').last)
29
+ end
30
+
24
31
  require 'mkmf'
25
32
 
26
33
  $LIBS << " -lpthread" if $LIBS !~ /-lpthread/
@@ -31,7 +31,7 @@ module PhusionPassenger
31
31
 
32
32
  PACKAGE_NAME = 'passenger'
33
33
  # Run 'rake src/cxx_supportlib/Constants.h configkit_schemas_inline_comments' after changing this number.
34
- VERSION_STRING = '6.0.1'
34
+ VERSION_STRING = '6.0.2'
35
35
 
36
36
  # Tip: find the SHA-256 with ./dev/nginx_version_sha2 <VERSION>
37
37
  PREFERRED_NGINX_VERSION = '1.15.8'
@@ -82,6 +82,14 @@ module PhusionPassenger
82
82
  end
83
83
  end
84
84
 
85
+ # :watchdog_pid: expected Integer.
86
+ #
87
+ # return: the matching instance, if found; nil otherwise.
88
+ #
89
+ def find_by_watchdog_pid(pid, options = {})
90
+ return list(options).detect { |instance| instance.watchdog_pid == pid }
91
+ end
92
+
85
93
  private
86
94
  def default_paths
87
95
  if result = string_env("PASSENGER_INSTANCE_REGISTRY_DIR")
@@ -137,6 +137,13 @@ APACHE2_CONFIGURATION_OPTIONS = [
137
137
  :dynamic_default => "Apache's global error log",
138
138
  :desc => "The #{PROGRAM_NAME} log file."
139
139
  },
140
+ {
141
+ :name => 'PassengerDisableLogPrefix',
142
+ :type => :flag,
143
+ :context => :global,
144
+ :default => false,
145
+ :desc => "Disable prefixing log statements with PID and channel."
146
+ },
140
147
  {
141
148
  :name => 'PassengerSocketBacklog',
142
149
  :type => :integer,
@@ -154,6 +154,14 @@ NGINX_CONFIGURATION_OPTIONS = [
154
154
  :context => [:main],
155
155
  :struct => 'NGX_HTTP_MAIN_CONF_OFFSET'
156
156
  },
157
+ {
158
+ :name => 'passenger_disable_log_prefix',
159
+ :scope => :global,
160
+ :type => :flag,
161
+ :default => false,
162
+ :context => [:main],
163
+ :struct => 'NGX_HTTP_MAIN_CONF_OFFSET'
164
+ },
157
165
  {
158
166
  :name => 'passenger_file_descriptor_log_file',
159
167
  :scope => :global,
@@ -557,6 +557,11 @@ module PhusionPassenger
557
557
  :default => DEFAULT_LOG_LEVEL,
558
558
  :desc => "Log level to use. Default: #{DEFAULT_LOG_LEVEL}"
559
559
  },
560
+ {
561
+ :name => :disable_log_prefix,
562
+ :type => :boolean,
563
+ :desc => "Disable prefixing log statements with PID and channel."
564
+ },
560
565
  {
561
566
  :name => :admin_panel_url,
562
567
  :type => :string,
@@ -111,6 +111,7 @@ module PhusionPassenger
111
111
  add_param(command, :instance_registry_dir, "--instance-registry-dir")
112
112
  add_param(command, :data_buffer_dir, "--data-buffer-dir")
113
113
  add_param(command, :log_level, "--log-level")
114
+ add_flag_param(command, :disable_log_prefix, "--disable-log-prefix")
114
115
  @options[:ctls].each do |ctl|
115
116
  command << " --ctl #{Shellwords.escape ctl}"
116
117
  end
@@ -191,6 +191,12 @@ class TeeInput
191
191
  self # Rack does not specify what the return value is here
192
192
  end
193
193
 
194
+ # Rack repeatedly introduces bugs that rely on this method existing
195
+ # https://github.com/rack/rack/pull/1201
196
+ def eof?
197
+ socket_drained?
198
+ end
199
+
194
200
  private
195
201
 
196
202
  def socket_drained?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passenger
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.1
4
+ version: 6.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phusion - http://www.phusion.nl/
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-06 00:00:00.000000000 Z
11
+ date: 2019-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake