-
Notifications
You must be signed in to change notification settings - Fork 856
TS-4399 TS-4400 Management API messes up proxy options #1073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
9f28180
3365b20
8203719
af59ccb
79b2b70
586b8ff
0fe5db3
10c10af
5a989cb
3619a85
9e09c30
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -189,6 +189,7 @@ LocalManager::LocalManager(bool proxy_on) : BaseManager(), run_proxy(proxy_on), | |
| proxy_launch_outstanding = false; | ||
| mgmt_shutdown_outstanding = MGMT_PENDING_NONE; | ||
| proxy_running = 0; | ||
| coreapi_sleep = true; | ||
|
|
||
| RecRegisterStatInt(RECT_NODE, "proxy.node.proxy_running", 0, RECP_NON_PERSISTENT); | ||
|
|
||
|
|
@@ -239,8 +240,8 @@ LocalManager::LocalManager(bool proxy_on) : BaseManager(), run_proxy(proxy_on), | |
| process_server_timeout_msecs = REC_readInteger("proxy.config.lm.pserver_timeout_msecs", &found); | ||
| proxy_name = REC_readString("proxy.config.proxy_name", &found); | ||
| proxy_binary = REC_readString("proxy.config.proxy_binary", &found); | ||
| proxy_options = REC_readString("proxy.config.proxy_binary_opts", &found); | ||
| env_prep = REC_readString("proxy.config.env_prep", &found); | ||
| proxy_options = NULL; | ||
|
|
||
| // Calculate proxy_binary from the absolute bin_path | ||
| absolute_proxy_binary = Layout::relative_to(bindir, proxy_binary); | ||
|
|
@@ -831,9 +832,13 @@ LocalManager::processEventQueue() | |
| /* | ||
| * startProxy() | ||
| * Function fires up a proxy process. | ||
| * | ||
| * Args: | ||
| * onetime_options: one time options that traffic_server should be started with (ie | ||
| * these options do not persist across reboots) | ||
| */ | ||
| bool | ||
| LocalManager::startProxy() | ||
| LocalManager::startProxy(const char *onetime_options) | ||
| { | ||
| if (proxy_launch_outstanding) { | ||
| return false; | ||
|
|
@@ -902,8 +907,13 @@ LocalManager::startProxy() | |
| Vec<char> real_proxy_options; | ||
|
|
||
| real_proxy_options.append(proxy_options, strlen(proxy_options)); | ||
| if (onetime_options && *onetime_options) { | ||
| real_proxy_options.append(" ", strlen(" ")); | ||
| real_proxy_options.append(onetime_options, strlen(onetime_options)); | ||
| } | ||
|
|
||
| if (!strstr(proxy_options, MGMT_OPT)) { // Make sure we're starting the proxy in mgmt mode | ||
| // Make sure we're starting the proxy in mgmt mode | ||
| if (!strstr(proxy_options, MGMT_OPT) && !strstr(onetime_options, MGMT_OPT)) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prefer |
||
| real_proxy_options.append(" ", strlen(" ")); | ||
| real_proxy_options.append(MGMT_OPT, sizeof(MGMT_OPT) - 1); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -184,21 +184,19 @@ ProxyStateSet(TSProxyStateT state, TSCacheClearT clear) | |
| ink_strlcat(tsArgs, " -k", sizeof(tsArgs)); | ||
| } | ||
|
|
||
| if (strlen(tsArgs) > 0) { /* Passed command line args for proxy */ | ||
| ats_free(lmgmt->proxy_options); | ||
| lmgmt->proxy_options = ats_strdup(tsArgs); | ||
| mgmt_log("[ProxyStateSet] Traffic Server Args: '%s'\n", lmgmt->proxy_options); | ||
| } | ||
| mgmt_log("[ProxyStateSet] Traffic Server Args: '%s %s'\n", lmgmt->proxy_options ? lmgmt->proxy_options : "", tsArgs); | ||
|
|
||
| lmgmt->run_proxy = true; | ||
| lmgmt->listenForProxy(); | ||
| lmgmt->startProxy(tsArgs); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you actually need to do the sleeping stuff here? Since you now call return lmgmt->startProxy(tsArgs) ? TS_ERR_OKAY : TS_ERR_FAIL;
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a good observation, I'm kicking myself for not seeing it before. |
||
|
|
||
| do { | ||
| mgmt_sleep_sec(1); | ||
| } while (i++ < 20 && (lmgmt->proxy_running == 0)); | ||
| if (lmgmt->coreapi_sleep) { | ||
| do { | ||
| mgmt_sleep_sec(1); | ||
| } while (i++ < 20 && (lmgmt->proxy_running == 0)); | ||
|
|
||
| if (!lmgmt->processRunning()) { | ||
| goto Lerror; | ||
| if (!lmgmt->processRunning()) | ||
| goto Lerror; | ||
| } | ||
|
|
||
| break; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in the other comment, I think we can get away without this.