You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by Igor Galić <i....@brainsware.org> on 2013/09/10 14:54:30 UTC

Re: [1/3] git commit: TS-2188 Never consider a simple / path as a healthcheck


----- Original Message -----
> Updated Branches:
>   refs/heads/master a27b9e73a -> f1bffdf25
> 
> 
> TS-2188 Never consider a simple / path as a healthcheck
> 
> This is an optimization, and a safety net, such that a simple
> / path can never be considered for a healthcheck.
> 
> 
> Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
> Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/9e82415f
> Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/9e82415f
> Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/9e82415f
> 
> Branch: refs/heads/master
> Commit: 9e82415fc2c40a628589f4053ad1103c5730bdb8
> Parents: 49d00ff
> Author: Scott Harris <sc...@harrisnet.id.au>
> Authored: Mon Sep 9 13:36:22 2013 -0600
> Committer: Leif Hedstrom <zw...@apache.org>
> Committed: Mon Sep 9 13:37:28 2013 -0600
> 
> ----------------------------------------------------------------------
>  CHANGES                                          | 3 +++
>  plugins/experimental/healthchecks/README         | 4 +++-
>  plugins/experimental/healthchecks/healthchecks.c | 4 ++++
>  3 files changed, 10 insertions(+), 1 deletion(-)
> ----------------------------------------------------------------------
> 
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9e82415f/CHANGES
> ----------------------------------------------------------------------
> diff --git a/CHANGES b/CHANGES
> index 878b55b..6734ed8 100644
> --- a/CHANGES
> +++ b/CHANGES
> @@ -3,6 +3,9 @@ Changes with Apache Traffic Server 4.1.0
>    
>    *) [TS-2191] not reschedule http_sm when the sm_list`s lock is not
>    acquired.
>  
> +  *) [TS-2188] Fixes to make healthcheck plugin not segfault, and parse
> +   the log files properly. Author: Scott Harris <sc...@harrisnet.id.au>.
> +
>    *) [TS-1086] Avoid edge case returning 304 to an unconditional request.
>       Diagnosis and patch by Mohamad Khateeb.
>  
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9e82415f/plugins/experimental/healthchecks/README
> ----------------------------------------------------------------------
> diff --git a/plugins/experimental/healthchecks/README
> b/plugins/experimental/healthchecks/README
> index 920dbe7..ab156ac 100644
> --- a/plugins/experimental/healthchecks/README
> +++ b/plugins/experimental/healthchecks/README
> @@ -6,8 +6,10 @@ This configuration contains one, or several, lines of the
> format
>  
>     <URI-path> <file-path> <mime> <file-exists-code> <file-missing-code>
>  
> +The URI-path can *not* be "/" only.
>  
> -For example,
> +
> +Examples:
>  
>     /__hc  /var/run/ts-alive  text/plain 200  403
>  
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9e82415f/plugins/experimental/healthchecks/healthchecks.c
> ----------------------------------------------------------------------
> diff --git a/plugins/experimental/healthchecks/healthchecks.c
> b/plugins/experimental/healthchecks/healthchecks.c
> index 47b4f7b..c7ae166 100644
> --- a/plugins/experimental/healthchecks/healthchecks.c
> +++ b/plugins/experimental/healthchecks/healthchecks.c
> @@ -500,6 +500,10 @@ health_check_origin(TSCont contp ATS_UNUSED, TSEvent
> event ATS_UNUSED, void *eda
>      int path_len = 0;
>      const char* path = TSUrlPathGet(reqp, url_loc, &path_len);
>  
> +    /* Short circuit the / path, common case, and we won't allow healthecks
> on / */
> +    if (!path || !path_len)

shouldn't this error out before going to cleanup?

> +      goto cleanup;
> +
>      while (info) {
>        if (info->p_len == path_len && !memcmp(info->path, path, path_len)) {
>          TSDebug(PLUGIN_NAME, "Found match for /%.*s", path_len, path);
> 
> 

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 6880 4155 74BD FD7C B515  2EA5 4B1D 9E08 A097 C9AE


Re: [1/3] git commit: TS-2188 Never consider a simple / path as a healthcheck

Posted by Leif Hedstrom <zw...@apache.org>.
On Sep 10, 2013, at 6:54 AM, Igor Galić <i....@brainsware.org> wrote:

> 
>> +    /* Short circuit the / path, common case, and we won't allow healthecks
>> on / */
>> +    if (!path || !path_len)
> 
> shouldn't this error out before going to cleanup?

No, it's not an error case, just an "optimization" such that on requests for "/", we don't even try to match up against possible health check URLs. The original bug reported used this as a bug fix, but that only hides the real bug (which is fixed in a separate commit).

-- leif