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
  *
@@ -36,6 +36,7 @@
36
36
  * rake ext/nginx/CreateLocationConfig.c
37
37
  */
38
38
 
39
+ void generated_set_conf_part(passenger_loc_conf_t *conf) {
39
40
 
40
41
 
41
42
 
@@ -201,3 +202,4 @@
201
202
  conf->vary_turbocache_by_cookie.len = 0;
202
203
 
203
204
 
205
+ }
@@ -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
  *
@@ -36,6 +36,7 @@
36
36
  * rake ext/nginx/CreateLocationConfig.c
37
37
  */
38
38
 
39
+ void generated_set_conf_part(passenger_loc_conf_t *conf) {
39
40
  <%
40
41
  require 'phusion_passenger/nginx/config_options'
41
42
 
@@ -73,3 +74,4 @@ end
73
74
  <% raise "Unknown option type #{option[:type].inspect} for option #{option[:name]}" %>
74
75
  <% end %>
75
76
  <% end %>
77
+ }
@@ -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
  *
@@ -36,6 +36,8 @@
36
36
  * rake ext/nginx/MergeLocationConfig.c
37
37
  */
38
38
 
39
+ /* 0: NGX_CONF_ERROR, 1: OK */
40
+ int generated_merge_part(passenger_loc_conf_t *conf, passenger_loc_conf_t *prev, ngx_conf_t *cf) {
39
41
 
40
42
 
41
43
 
@@ -109,7 +111,7 @@
109
111
  if (merge_string_array(cf, &prev->base_uris, &conf->base_uris) != NGX_OK) {
110
112
  ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
111
113
  "cannot merge \"passenger_base_uri\" configurations");
112
- return NGX_CONF_ERROR;
114
+ return 0;
113
115
  }
114
116
 
115
117
 
@@ -159,7 +161,7 @@
159
161
  if (merge_string_array(cf, &prev->union_station_filters, &conf->union_station_filters) != NGX_OK) {
160
162
  ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
161
163
  "cannot merge \"union_station_filter\" configurations");
162
- return NGX_CONF_ERROR;
164
+ return 0;
163
165
  }
164
166
 
165
167
 
@@ -179,7 +181,7 @@
179
181
  if (merge_string_keyval_table(cf, &prev->env_vars, &conf->env_vars) != NGX_OK) {
180
182
  ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
181
183
  "cannot merge \"passenger_env_var\" configurations");
182
- return NGX_CONF_ERROR;
184
+ return 0;
183
185
  }
184
186
 
185
187
 
@@ -261,3 +263,5 @@
261
263
  NULL);
262
264
 
263
265
 
266
+ return 1;
267
+ }
@@ -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
  *
@@ -36,6 +36,8 @@
36
36
  * rake ext/nginx/MergeLocationConfig.c
37
37
  */
38
38
 
39
+ /* 0: NGX_CONF_ERROR, 1: OK */
40
+ int generated_merge_part(passenger_loc_conf_t *conf, passenger_loc_conf_t *prev, ngx_conf_t *cf) {
39
41
  <%
40
42
  require 'phusion_passenger/nginx/config_options'
41
43
 
@@ -99,15 +101,17 @@ end
99
101
  if (merge_string_array(cf, &prev-><%= struct_field_for(option) %>, &conf-><%= struct_field_for(option) %>) != NGX_OK) {
100
102
  ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
101
103
  "cannot merge \"<%= option[:name] %>\" configurations");
102
- return NGX_CONF_ERROR;
104
+ return 0;
103
105
  }
104
106
  <% elsif option[:type] == :string_keyval %>
105
107
  if (merge_string_keyval_table(cf, &prev-><%= struct_field_for(option) %>, &conf-><%= struct_field_for(option) %>) != NGX_OK) {
106
108
  ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
107
109
  "cannot merge \"<%= option[:name] %>\" configurations");
108
- return NGX_CONF_ERROR;
110
+ return 0;
109
111
  }
110
112
  <% else %>
111
113
  <% raise "Unknown option type #{option[:type].inspect} for option #{option[:name]}" %>
112
114
  <% end %>
113
115
  <% end %>
116
+ return 1;
117
+ }
@@ -47,10 +47,6 @@
47
47
  #include "common/Utils/modp_b64.cpp" /* File is C compatible. */
48
48
 
49
49
 
50
- #define HELPER_SERVER_MAX_SHUTDOWN_TIME 5
51
- #define HELPER_SERVER_PASSWORD_SIZE 64
52
-
53
-
54
50
  static int first_start = 1;
55
51
  ngx_str_t pp_schema_string;
56
52
  ngx_str_t pp_placeholder_upstream_address;
@@ -101,8 +97,10 @@ ignore_sigpipe() {
101
97
  static char *
102
98
  ngx_str_null_terminate(ngx_str_t *str) {
103
99
  char *result = malloc(str->len + 1);
104
- memcpy(result, str->data, str->len);
105
- result[str->len] = '\0';
100
+ if (result != NULL) {
101
+ memcpy(result, str->data, str->len);
102
+ result[str->len] = '\0';
103
+ }
106
104
  return result;
107
105
  }
108
106
 
@@ -147,10 +145,10 @@ save_master_process_pid(ngx_cycle_t *cycle) {
147
145
  }
148
146
 
149
147
  /**
150
- * This function is called after forking and just before exec()ing the helper server.
148
+ * This function is called after forking and just before exec()ing the watchdog.
151
149
  */
152
150
  static void
153
- starting_helper_server_after_fork(void *arg) {
151
+ starting_watchdog_after_fork(void *arg) {
154
152
  ngx_cycle_t *cycle = (void *) arg;
155
153
  char *log_filename;
156
154
  FILE *log_file;
@@ -245,6 +243,7 @@ start_watchdog(ngx_cycle_t *cycle) {
245
243
  ngx_core_conf_t *core_conf;
246
244
  ngx_int_t ret, result;
247
245
  ngx_uint_t i;
246
+ char *config_file = NULL;
248
247
  ngx_str_t *prestart_uris;
249
248
  char **prestart_uris_ary = NULL;
250
249
  ngx_keyval_t *ctl = NULL;
@@ -257,24 +256,29 @@ start_watchdog(ngx_cycle_t *cycle) {
257
256
  result = NGX_OK;
258
257
  params = pp_variant_map_new();
259
258
  passenger_root = ngx_str_null_terminate(&passenger_main_conf.root_dir);
259
+ if (passenger_root == NULL) {
260
+ goto error_enomem;
261
+ }
260
262
 
261
263
  pp_app_type_detector_set_throttle_rate(pp_app_type_detector,
262
264
  passenger_main_conf.stat_throttle_rate);
263
265
 
266
+ config_file = ngx_str_null_terminate(&cycle->conf_file);
267
+ if (config_file == NULL) {
268
+ goto error_enomem;
269
+ }
270
+
264
271
  prestart_uris = (ngx_str_t *) passenger_main_conf.prestart_uris->elts;
265
272
  prestart_uris_ary = calloc(sizeof(char *), passenger_main_conf.prestart_uris->nelts);
266
273
  for (i = 0; i < passenger_main_conf.prestart_uris->nelts; i++) {
267
- prestart_uris_ary[i] = malloc(prestart_uris[i].len + 1);
274
+ prestart_uris_ary[i] = ngx_str_null_terminate(&prestart_uris[i]);
268
275
  if (prestart_uris_ary[i] == NULL) {
269
- ngx_log_error(NGX_LOG_ALERT, cycle->log, ENOMEM, "Cannot allocate memory");
270
- result = NGX_ERROR;
271
- goto cleanup;
276
+ goto error_enomem;
272
277
  }
273
- memcpy(prestart_uris_ary[i], prestart_uris[i].data, prestart_uris[i].len);
274
- prestart_uris_ary[i][prestart_uris[i].len] = '\0';
275
278
  }
276
279
 
277
280
  pp_variant_map_set_int (params, "web_server_pid", getpid());
281
+ pp_variant_map_set_strset (params, "web_server_config_files", (const char **) &config_file, 1);
278
282
  pp_variant_map_set (params, "server_software", NGINX_VER, strlen(NGINX_VER));
279
283
  pp_variant_map_set_bool (params, "multi_app", 1);
280
284
  pp_variant_map_set_bool (params, "load_shell_envvars", 1);
@@ -325,7 +329,7 @@ start_watchdog(ngx_cycle_t *cycle) {
325
329
  ret = pp_agents_starter_start(pp_agents_starter,
326
330
  passenger_root,
327
331
  params,
328
- starting_helper_server_after_fork,
332
+ starting_watchdog_after_fork,
329
333
  cycle,
330
334
  &error_message);
331
335
  if (!ret) {
@@ -354,29 +358,11 @@ start_watchdog(ngx_cycle_t *cycle) {
354
358
  goto cleanup;
355
359
  }
356
360
 
357
- /* Create various other info files. */
358
- last = ngx_snprintf(filename, sizeof(filename) - 1,
359
- "%s/web_server.txt",
360
- pp_agents_starter_get_instance_dir(pp_agents_starter, NULL));
361
- *last = (u_char) '\0';
362
- if (create_file(cycle, filename, (const u_char *) NGINX_VER, strlen(NGINX_VER)) != NGX_OK) {
363
- result = NGX_ERROR;
364
- goto cleanup;
365
- }
366
-
367
- last = ngx_snprintf(filename, sizeof(filename) - 1,
368
- "%s/config_files.txt",
369
- pp_agents_starter_get_instance_dir(pp_agents_starter, NULL));
370
- *last = (u_char) '\0';
371
- if (create_file(cycle, filename, cycle->conf_file.data, cycle->conf_file.len) != NGX_OK) {
372
- result = NGX_ERROR;
373
- goto cleanup;
374
- }
375
-
376
361
  cleanup:
377
362
  pp_variant_map_free(params);
378
363
  free(passenger_root);
379
364
  free(error_message);
365
+ free(config_file);
380
366
  if (prestart_uris_ary != NULL) {
381
367
  for (i = 0; i < passenger_main_conf.prestart_uris->nelts; i++) {
382
368
  free(prestart_uris_ary[i]);
@@ -389,13 +375,18 @@ cleanup:
389
375
  }
390
376
 
391
377
  return result;
378
+
379
+ error_enomem:
380
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, ENOMEM, "Cannot allocate memory");
381
+ result = NGX_ERROR;
382
+ goto cleanup;
392
383
  }
393
384
 
394
385
  /**
395
- * Shutdown the helper server, if there's one running.
386
+ * Shutdown the watchdog, if there's one running.
396
387
  */
397
388
  static void
398
- shutdown_helper_server() {
389
+ shutdown_watchdog() {
399
390
  if (pp_agents_starter != NULL) {
400
391
  pp_agents_starter_free(pp_agents_starter);
401
392
  pp_agents_starter = NULL;
@@ -413,13 +404,13 @@ pre_config_init(ngx_conf_t *cf)
413
404
  {
414
405
  char *error_message;
415
406
 
416
- shutdown_helper_server();
407
+ shutdown_watchdog();
417
408
 
418
409
  ngx_memzero(&passenger_main_conf, sizeof(passenger_main_conf_t));
419
410
  pp_schema_string.data = (u_char *) "passenger:";
420
411
  pp_schema_string.len = sizeof("passenger:") - 1;
421
- pp_placeholder_upstream_address.data = (u_char *) "unix:/passenger_helper_server";
422
- pp_placeholder_upstream_address.len = sizeof("unix:/passenger_helper_server") - 1;
412
+ pp_placeholder_upstream_address.data = (u_char *) "unix:/passenger_core";
413
+ pp_placeholder_upstream_address.len = sizeof("unix:/passenger_core") - 1;
423
414
  pp_stat_cache = pp_cached_file_stat_new(1024);
424
415
  pp_app_type_detector = pp_app_type_detector_new(DEFAULT_STAT_THROTTLE_RATE);
425
416
  pp_agents_starter = pp_agents_starter_new(AS_NGINX, &error_message);
@@ -442,9 +433,9 @@ static ngx_int_t
442
433
  init_module(ngx_cycle_t *cycle) {
443
434
  if (passenger_main_conf.root_dir.len != 0 && !ngx_test_config) {
444
435
  if (first_start) {
445
- /* Ignore SIGPIPE now so that, if the helper server fails to start,
436
+ /* Ignore SIGPIPE now so that, if the watchdog fails to start,
446
437
  * Nginx doesn't get killed by the default SIGPIPE handler upon
447
- * writing the password to the helper server.
438
+ * writing the password to the watchdog.
448
439
  */
449
440
  ignore_sigpipe();
450
441
  first_start = 0;
@@ -486,7 +477,7 @@ init_worker_process(ngx_cycle_t *cycle) {
486
477
  */
487
478
  static void
488
479
  exit_master(ngx_cycle_t *cycle) {
489
- shutdown_helper_server();
480
+ shutdown_watchdog();
490
481
  }
491
482
 
492
483
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # Phusion Passenger - https://www.phusionpassenger.com/
3
- # Copyright (c) 2013 Phusion
3
+ # Copyright (c) 2013-2015 Phusion
4
4
  #
5
5
  # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
6
  #
@@ -102,7 +102,7 @@ begin
102
102
  # Example lines:
103
103
  # ./test() [0x400b64]
104
104
  # /lib/libc.so.6(__libc_start_main+0xfd) [0x7fcc0ad00c8d]
105
- # PassengerAgent server[0x4d2697]
105
+ # Passenger core[0x4d2697]
106
106
  if line =~ /(.*)\[(.*?)\]$/
107
107
  # Split line into:
108
108
  # subject: /lib/libc.so.6(__libc_start_main+0xfd)
@@ -30,7 +30,7 @@ module PhusionPassenger
30
30
 
31
31
  PACKAGE_NAME = 'passenger'
32
32
  # Run 'rake ext/common/Constants.h' after changing this number.
33
- VERSION_STRING = '5.0.10'
33
+ VERSION_STRING = '5.0.11'
34
34
 
35
35
  PREFERRED_NGINX_VERSION = '1.8.0'
36
36
  NGINX_SHA256_CHECKSUM = '23cca1239990c818d8f6da118320c4979aadf5386deda691b1b7c2c96b9df3d5'
@@ -108,8 +108,8 @@ module PhusionPassenger
108
108
  return response
109
109
  end
110
110
 
111
- def server_pid
112
- @server_pid ||= File.read("#{@path}/server.pid").to_i
111
+ def core_pid
112
+ @core_pid ||= File.read("#{@path}/core.pid").to_i
113
113
  end
114
114
 
115
115
  def full_admin_password
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  # Phusion Passenger - https://www.phusionpassenger.com/
3
- # Copyright (c) 2014 Phusion
3
+ # Copyright (c) 2014-2015 Phusion
4
4
  #
5
5
  # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
6
  #
@@ -84,12 +84,16 @@ module PhusionPassenger
84
84
  private
85
85
  def default_paths
86
86
  if result = string_env("PASSENGER_INSTANCE_REGISTRY_DIR")
87
- return result
87
+ return [result]
88
88
  end
89
89
 
90
+ # On OSX, TMPDIR is set to a different value per-user. But Apache
91
+ # is launched through Launchctl and runs without TMPDIR (and thus
92
+ # uses the default /tmp).
93
+ #
90
94
  # The RPM packages configure Apache and Nginx to use /var/run/passenger-instreg
91
95
  # as the instance registry dir. See https://github.com/phusion/passenger/issues/1475
92
- [string_env("TMPDIR") || "/tmp", "/var/run/passenger-instreg"]
96
+ [string_env("TMPDIR"), "/tmp", "/var/run/passenger-instreg"].compact
93
97
  end
94
98
 
95
99
  def string_env(name)
@@ -475,18 +475,18 @@ COMMON_LIBRARY = CommonLibraryBuilder.new do
475
475
  Utils/IniFile.h
476
476
  Utils/VariantMap.h
477
477
  )
478
- define_component 'AgentsBase.o',
479
- :source => 'agents/Base.cpp',
478
+ define_component 'AgentBase.o',
479
+ :source => 'agent/Base.cpp',
480
480
  :category => :other,
481
481
  :deps => %w(
482
- agents/Base.h
482
+ agent/Base.h
483
483
  Utils/VariantMap.h
484
484
  )
485
- define_component 'agents/LoggingAgent/FilterSupport.o',
486
- :source => 'agents/LoggingAgent/FilterSupport.cpp',
487
- :category => :logging_agent,
485
+ define_component 'agent/UstRouter/FilterSupport.o',
486
+ :source => 'agent/UstRouter/FilterSupport.cpp',
487
+ :category => :ust_router,
488
488
  :deps => %w(
489
- agents/LoggingAgent/FilterSupport.h
489
+ agent/UstRouter/FilterSupport.h
490
490
  )
491
491
  define_component 'MemoryKit/mbuf.o',
492
492
  :source => 'MemoryKit/mbuf.cpp',
@@ -546,4 +546,4 @@ end
546
546
 
547
547
  # Objects that must be linked into the Nginx binary.
548
548
  NGINX_LIBS_SELECTOR = [:base, 'AgentsStarter.o', 'ApplicationPool2/AppTypes.o',
549
- 'Utils/CachedFileStat.o', 'agents/LoggingAgent/FilterSupport.o']
549
+ 'Utils/CachedFileStat.o', 'agent/UstRouter/FilterSupport.o']
@@ -167,7 +167,7 @@ module PhusionPassenger
167
167
  end
168
168
  puts
169
169
  puts "## Notes for RVM users"
170
- puts "Do you want to know which command to use for a different Ruby interpreter? 'rvm use' that Ruby interpreter, then re-run 'passenger-config --ruby-command'."
170
+ puts "Do you want to know which command to use for a different Ruby interpreter? 'rvm use' that Ruby interpreter, then re-run 'passenger-config about ruby-command'."
171
171
  when "--rubyext-compat-id"
172
172
  PhusionPassenger.require_passenger_lib 'platform_info/binary_compatibility'
173
173
  puts PhusionPassenger::PlatformInfo.ruby_extension_binary_compatibility_id
@@ -37,7 +37,7 @@ module PhusionPassenger
37
37
  include PhusionPassenger::Config::Utils
38
38
 
39
39
  def self.create_default_options
40
- { :agent_name => "server_api" }
40
+ { :agent_name => "core_api" }
41
41
  end
42
42
 
43
43
  def run
@@ -93,8 +93,8 @@ module PhusionPassenger
93
93
  opts.on("-a", "--agent NAME", String, "The name of the socket to send the command#{nl}" +
94
94
  "to. This specifies which agent the request#{nl}" +
95
95
  "is sent to. Choices: watchdog_api,#{nl}" +
96
- "server_api, logging_api.#{nl}" +
97
- "Default: server_api") do |val|
96
+ "core_api, ust_router_api.#{nl}" +
97
+ "Default: core_api") do |val|
98
98
  options[:agent_name] = val
99
99
  end
100
100
  opts.on("-S", "--socket PATH", String, "Instead of inferring the socket path from#{nl}" +
@@ -32,6 +32,7 @@ PhusionPassenger.require_passenger_lib 'console_text_template'
32
32
  PhusionPassenger.require_passenger_lib 'platform_info/ruby'
33
33
  PhusionPassenger.require_passenger_lib 'platform_info/depcheck'
34
34
  PhusionPassenger.require_passenger_lib 'utils/ansi_colors'
35
+ PhusionPassenger.require_passenger_lib 'utils/tmpio'
35
36
 
36
37
  module PhusionPassenger
37
38
  module Config
@@ -123,29 +124,41 @@ module PhusionPassenger
123
124
  end
124
125
 
125
126
  def run_rake_task!(target)
126
- total_lines = `#{rake} #{target} --dry-run STDERR_TO_STDOUT=1`.split("\n").size - 1
127
- backlog = ""
128
-
129
- command = "#{rake} #{target} --trace STDERR_TO_STDOUT=1"
130
- IO.popen(command, "rb") do |io|
131
- progress = 1
132
- while !io.eof?
133
- line = io.readline
134
- yield(progress, total_lines)
135
- if line =~ /^\*\* /
136
- backlog.replace("")
137
- progress += 1
138
- else
139
- backlog << line
127
+ total_lines = `#{rake} #{target} --dry-run STDERR_TO_STDOUT=1 2>&1`.split("\n").size - 1
128
+ partial_backlog = ""
129
+ logfile = PhusionPassenger::Utils::TmpIO.new("passenger-install-log",
130
+ :mode => File::WRONLY, :unlink_immediately => false)
131
+
132
+ begin
133
+ command = "#{rake} #{target} --trace STDERR_TO_STDOUT=1 2>&1"
134
+ IO.popen(command, "rb") do |io|
135
+ progress = 1
136
+ while !io.eof?
137
+ line = io.readline
138
+ logfile.write(line)
139
+ yield(progress, total_lines)
140
+ if line =~ /^\*\* /
141
+ partial_backlog.replace("")
142
+ progress += 1
143
+ else
144
+ partial_backlog << line
145
+ end
140
146
  end
141
147
  end
142
- end
143
- if $?.exitstatus != 0
144
- stderr = @stderr || STDERR
145
- stderr.puts
146
- stderr.puts "*** ERROR: the following command failed:"
147
- stderr.puts(backlog)
148
- exit 1
148
+ if $?.exitstatus != 0
149
+ colors = @colors || PhusionPassenger::Utils::AnsiColors.new
150
+ stderr = @stderr || STDERR
151
+ stderr.puts
152
+ stderr.puts "#{colors.red}*** ERROR: a Rake command failed. You can find the full " +
153
+ "log in #{logfile.path}. Below, you can find the last few lines of the command's output.#{colors.reset}"
154
+ stderr.puts "#{colors.red}------------- Begin command output snippet -------------#{colors.reset}"
155
+ stderr.puts(partial_backlog)
156
+ stderr.puts "#{colors.red}------------- End command output snippet -------------#{colors.reset}"
157
+ stderr.puts "#{colors.red}The full log can be found in #{logfile.path}#{colors.reset}"
158
+ exit 1
159
+ end
160
+ ensure
161
+ logfile.close
149
162
  end
150
163
  end
151
164