Repository: trafficserver Updated Branches: refs/heads/master 46a563dd1 -> 30ad08309
TS-306: Fix regression and compile issues for certain architectures. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/30ad0830 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/30ad0830 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/30ad0830 Branch: refs/heads/master Commit: 30ad083096eae278ff1236664edfb9bf421573a4 Parents: 46a563d Author: Alan M. Carroll <[email protected]> Authored: Wed Nov 4 23:48:04 2015 -0600 Committer: Alan M. Carroll <[email protected]> Committed: Wed Nov 4 23:48:04 2015 -0600 ---------------------------------------------------------------------- lib/ts/Diags.cc | 4 ++-- mgmt/api/CoreAPI.cc | 2 +- proxy/InkAPITest.cc | 5 +++-- proxy/Main.cc | 16 +++++++--------- 4 files changed, 13 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/30ad0830/lib/ts/Diags.cc ---------------------------------------------------------------------- diff --git a/lib/ts/Diags.cc b/lib/ts/Diags.cc index ef419a6..68a61b9 100644 --- a/lib/ts/Diags.cc +++ b/lib/ts/Diags.cc @@ -816,7 +816,7 @@ Diags::set_stdout_output(const char *_bind_stdout) } // get root - ElevateAccess elevate(true); + ElevateAccess elevate(); // create backing BaseLogFile for stdout stdout_log = new BaseLogFile(_bind_stdout); @@ -855,7 +855,7 @@ Diags::set_stderr_output(const char *_bind_stderr) stderr_log = NULL; } // get root - ElevateAccess elevate(true); + ElevateAccess elevate(); // create backing BaseLogFile for stdout stderr_log = new BaseLogFile(_bind_stderr); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/30ad0830/mgmt/api/CoreAPI.cc ---------------------------------------------------------------------- diff --git a/mgmt/api/CoreAPI.cc b/mgmt/api/CoreAPI.cc index 972de27..2d249b8 100644 --- a/mgmt/api/CoreAPI.cc +++ b/mgmt/api/CoreAPI.cc @@ -362,7 +362,7 @@ ServerBacktrace(unsigned /* options */, char **trace) // Unfortunately, we need to be privileged here. We either need to be root or to be holding // the CAP_SYS_PTRACE capability. Even though we are the parent traffic_manager, it is not // traceable without privilege because the process credentials do not match. - ElevateAccess access(true, ElevateAccess::TRACE_PRIVILEGE); + ElevateAccess access(ElevateAccess::TRACE_PRIVILEGE); threadlist threads(threads_for_process(lmgmt->watched_process_pid)); textBuffer text(0); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/30ad0830/proxy/InkAPITest.cc ---------------------------------------------------------------------- diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc index 68cfb92..4be5099 100644 --- a/proxy/InkAPITest.cc +++ b/proxy/InkAPITest.cc @@ -2179,6 +2179,7 @@ checkHttpTxnServerRespGet(SocketTest *test, void *data) // This func is called both by us when scheduling EVENT_IMMEDIATE // And by HTTP SM for registered hooks +// Depending on the timing of the DNS response, OS_DNS can happen before or after CACHE_LOOKUP. static int mytest_handler(TSCont contp, TSEvent event, void *data) { @@ -2215,7 +2216,7 @@ mytest_handler(TSCont contp, TSEvent event, void *data) break; case TS_EVENT_HTTP_OS_DNS: - if (test->hook_mask == 7) { + if (test->hook_mask == 3 || test->hook_mask == 7) { test->hook_mask |= 8; } @@ -2230,7 +2231,7 @@ mytest_handler(TSCont contp, TSEvent event, void *data) break; case TS_EVENT_HTTP_CACHE_LOOKUP_COMPLETE: - if (test->hook_mask == 3) { + if (test->hook_mask == 3 || test->hook_mask == 11) { test->hook_mask |= 4; } TSHttpTxnReenable((TSHttpTxn)data, TS_EVENT_HTTP_CONTINUE); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/30ad0830/proxy/Main.cc ---------------------------------------------------------------------- diff --git a/proxy/Main.cc b/proxy/Main.cc index 992eaca..759a6c3 100644 --- a/proxy/Main.cc +++ b/proxy/Main.cc @@ -1485,21 +1485,12 @@ main(int /* argc ATS_UNUSED */, const char **argv) if (cmd_disable_freelist) { ink_freelist_init_ops(ink_freelist_malloc_ops()); } - // Bind stdout and stderr to specified switches - // Still needed despite the set_std{err,out}_output() calls later since there are - // fprintf's before those calls - bind_outputs(bind_stdout, bind_stderr); - // Specific validity checks. if (*conf_dir && command_index != find_cmd_index(CMD_VERIFY_CONFIG)) { fprintf(stderr, "-D option can only be used with the %s command\n", CMD_VERIFY_CONFIG); _exit(1); } - // Set stdout/stdin to be unbuffered - setbuf(stdout, NULL); - setbuf(stdin, NULL); - // Bootstrap syslog. Since we haven't read records.config // yet we do not know where openlog("traffic_server", LOG_PID | LOG_NDELAY | LOG_NOWAIT, LOG_DAEMON); @@ -1513,6 +1504,8 @@ main(int /* argc ATS_UNUSED */, const char **argv) // re-start Diag completely) because at initialize, TM only has 1 thread. // In TS, some threads have already created, so if we delete Diag and // re-start it again, TS will crash. + // This is also needed for log rotation - setting up the file can cause privilege + // related errors and if diagsConfig isn't get up yet that will crash on a NULL pointer. diagsConfig = new DiagsConfig(DIAGS_LOG_FILENAME, error_tags, action_tags, false); diags = diagsConfig->diags; diags->prefix_str = "Server "; @@ -1521,6 +1514,11 @@ main(int /* argc ATS_UNUSED */, const char **argv) if (is_debug_tag_set("diags")) diags->dump(); + // Bind stdout and stderr to specified switches + // Still needed despite the set_std{err,out}_output() calls later since there are + // fprintf's before those calls + bind_outputs(bind_stdout, bind_stderr); + // Local process manager initialize_process_manager();
