-
Notifications
You must be signed in to change notification settings - Fork 0
/
passenger.diff
81 lines (74 loc) · 2.65 KB
/
passenger.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
diff --git a/src/agent/Core/CoreMain.cpp b/src/agent/Core/CoreMain.cpp
index 426f0af3..e34490d7 100644
--- a/src/agent/Core/CoreMain.cpp
+++ b/src/agent/Core/CoreMain.cpp
@@ -1347,7 +1347,6 @@ runCore() {
initializeCurl();
initializeNonPrivilegedWorkingObjects();
initializeSecurityUpdateChecker();
- initializeTelemetryCollector();
initializeAdminPanelConnector();
prestartWebApps();
diff --git a/src/nginx_module/ngx_http_passenger_module.c b/src/nginx_module/ngx_http_passenger_module.c
index 7d40f622..b48f01b9 100644
--- a/src/nginx_module/ngx_http_passenger_module.c
+++ b/src/nginx_module/ngx_http_passenger_module.c
@@ -193,6 +193,29 @@ save_master_process_pid(ngx_cycle_t *cycle) {
return NGX_OK;
}
+static ngx_int_t
+save_child_process_pid(ngx_cycle_t *cycle) {
+ u_char filename[NGX_MAX_PATH];
+ u_char *last;
+ FILE *f;
+
+ last = ngx_snprintf(filename, sizeof(filename) - 1, "%s/web_server_info/child_processes.pid",
+ psg_watchdog_launcher_get_instance_dir(psg_watchdog_launcher, NULL));
+ *last = (u_char) '\0';
+
+ f = fopen((const char *) filename, "a");
+ if (f != NULL) {
+ fprintf(f, "%ld\n", (long) getpid());
+ fclose(f);
+ } else {
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
+ "could not create %s", filename);
+ }
+
+ return NGX_OK;
+}
+
+
typedef struct {
ngx_cycle_t *cycle;
int log_fd;
@@ -464,6 +487,18 @@ start_watchdog(ngx_cycle_t *cycle) {
result = NGX_ERROR;
goto cleanup;
}
+ last = ngx_snprintf(filename, sizeof(filename) - 1,
+ "%s/web_server_info/child_processes.pid",
+ psg_watchdog_launcher_get_instance_dir(psg_watchdog_launcher, NULL));
+ *last = (u_char) '\0';
+ if (create_file(cycle, filename, (const u_char *) "", 0, (uid_t) core_conf->user, (gid_t) -1) != NGX_OK) {
+ result = NGX_ERROR;
+ goto cleanup;
+ }
+ if (ret == -1) {
+ result = NGX_ERROR;
+ goto cleanup;
+ }
cleanup:
psg_json_value_free(w_config);
@@ -509,7 +544,6 @@ pre_config_init(ngx_conf_t *cf)
{
char *error_message;
- shutdown_watchdog();
ngx_memzero(&passenger_main_conf, sizeof(passenger_main_conf_t));
pp_schema_string.data = (u_char *) "passenger:";
@@ -571,6 +605,7 @@ init_worker_process(ngx_cycle_t *cycle) {
if (passenger_main_conf.autogenerated.root_dir.len != 0 && !ngx_test_config) {
save_master_process_pid(cycle);
+ save_child_process_pid(cycle);
core_conf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
if (core_conf->master) {