You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Georg Henzler (JIRA)" <ji...@apache.org> on 2019/04/09 08:44:00 UTC

[jira] [Comment Edited] (FELIX-6097) Improve startup behaviour of ServiceUnavailableFilter for low start levels

    [ https://issues.apache.org/jira/browse/FELIX-6097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16813130#comment-16813130 ] 

Georg Henzler edited comment on FELIX-6097 at 4/9/19 8:43 AM:
--------------------------------------------------------------

Useful bash script to watch response codes during startup:
{code}
http_code=-1
last_http_code=-1
url=${1:-http://localhost:8080/}

for ((i=1;;i++)); 
do
    timestamp=`date +%T.%3N`
    outputFile="curl-$timestamp.out"
    http_code=`curl -o $outputFile -f --max-time 2 --connect-timeout 2 -w "%{http_code}" "$url" 2> error.log`
    http_code=$((http_code))

    if (( http_code != 500 )); then # keep 500 responses for analysis, delete others
    	rm -f $outputFile 
    fi

    logMsg="$timestamp $url response code: $http_code"
    if (( http_code != last_http_code )); then
	  echo "$logMsg";
    else
      if ((i % 50 == 0 )); then
         echo "$logMsg (still unchanged)";
      fi
    fi
    last_http_code=$http_code
done
{code}


was (Author: henzlerg):
Useful bash script to see check response codes during startup:
{code}
http_code=-1
last_http_code=-1
url=${1:-http://localhost:8080/}

for ((i=1;;i++)); 
do
    timestamp=`date +%T.%3N`
    outputFile="curl-$timestamp.out"
    http_code=`curl -o $outputFile -f --max-time 2 --connect-timeout 2 -w "%{http_code}" "$url" 2> error.log`
    http_code=$((http_code))

    if (( http_code != 500 )); then # keep 500 responses for analysis, delete others
    	rm -f $outputFile 
    fi

    logMsg="$timestamp $url response code: $http_code"
    if (( http_code != last_http_code )); then
	  echo "$logMsg";
    else
      if ((i % 50 == 0 )); then
         echo "$logMsg (still unchanged)";
      fi
    fi
    last_http_code=$http_code
done
{code}

> Improve startup behaviour of ServiceUnavailableFilter for low start levels
> --------------------------------------------------------------------------
>
>                 Key: FELIX-6097
>                 URL: https://issues.apache.org/jira/browse/FELIX-6097
>             Project: Felix
>          Issue Type: Improvement
>          Components: Health Checks
>    Affects Versions: healthcheck.core 2.0.2
>            Reporter: Georg Henzler
>            Assignee: Georg Henzler
>            Priority: Major
>
> After some analysis and after comparing with the sling mechanism at [1], it turns out that if a filter is registered to the http whiteboard, it only becomes active if there is actually a servlet to answer the request (otherwise the filter will never kick in and the request just return 404). 
> In a setup that uses a product that registers the http whiteboard at start level 5 and the product servlets at start level 20, the current version of ServiceUnavailableFilter only kicks in at start level 20 once the product servlets become active when it should really already return 503 during startup start levels 5-19. Although the 404 response code is usually treated equally by machine clients (load balancers, kubernetes probles) it is still not semantically correct, hence this shall be improved to use the mechanism of [1].
> [1] https://github.com/apache/sling-org-apache-sling-starter-startup/blob/f9f9496588e335d7bdee0246abff5fb22051809f/src/main/java/org/apache/sling/starter/startup/impl/HttpStartupSetup.java#L61



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)