[ 
https://issues.apache.org/jira/browse/KNOX-2157?focusedWorklogId=365772&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-365772
 ]

ASF GitHub Bot logged work on KNOX-2157:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 03/Jan/20 09:46
            Start Date: 03/Jan/20 09:46
    Worklog Time Spent: 10m 
      Work Description: smolnar82 commented on issue #230: KNOX-2157 - 
Verifying the server's state in addition to PID check at gateway start
URL: https://github.com/apache/knox/pull/230#issuecomment-570520825
 
 
   The main difference between our tests and the way how we start it from the 
startup script is:
   * within the tests we directly call `GatewayServer.startServer` (usually in 
methods annotated with `@BeforeClass`) and wait until it returns
   * whereas in the script - where the application is configured to run in the 
background by default - creates a Java process with `nohup` which invokes 
`GatewayServer.main()` with the given argument and let the process live its own 
life in the background. Right after the Java call the script continues to check 
if the PID exists. Usually, it takes some time for the server to start up but 
the script indicates it's up&running because the PID is there.
   
   It's not _easy_ to add hook in a shell script to check the 2nd case:
   1. either the server persists its state somewhere which the script can read 
(this is what I implemented here)
   2. or the script tries to ping the server somehow
   2.1. The REST API would be ideal, but this would require at least one 
servlet which does not require authentication.
   2.2. Or one might try to check if the port is open. For instance:
   ```
   $ nc -z localhost 8443
   
   $ echo $?
   1
   
   $ nc -z localhost 8443
   
   $ echo $?
   1
   
   $ nc -z localhost 8443
   Connection to localhost port 8443 [tcp/pcsync-https] succeeded!
   
   $ echo $?
   0
   ```
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 365772)
    Time Spent: 0.5h  (was: 20m)

> Knox should check if it's actually up&running
> ---------------------------------------------
>
>                 Key: KNOX-2157
>                 URL: https://issues.apache.org/jira/browse/KNOX-2157
>             Project: Apache Knox
>          Issue Type: New Feature
>          Components: Server
>    Affects Versions: 1.1.0, 1.2.0, 1.3.0
>            Reporter: Sandor Molnar
>            Assignee: Sandor Molnar
>            Priority: Major
>             Fix For: 1.4.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> As of now, Knox returns a success code in case the process is being created. 
> There should be another way to check if the server is actually up&running and 
> is capable of serving incoming requests.
>  My proposal is:
>  * the Knox startup script should be modified to run a basic Admin API check 
> in case {{--test-gateway-url}} is defined in the startup command. If this is 
> blank or non-defined we fallback to the existing PID-based check
>  * two more optional arguments will be defined for this feature:
>  ** {{--test-gateway-retry-attempts}}: indicates the number of tries the 
> startup script should execute before it fails. Defaults to 5.
>  ** {{--test-gateway-retry-sleep}}: the amount of time that the test process 
> will wait or sleep before a retry is issued. Defaults to 2s.
> The new-style check will use {{curl}} and will return success in case 
> {{$GATEWAY_TEST_URL/gateway/admin/api/v1/version/}} returns an HTTP response 
> with code 200. If this is not true; the startup script should return an error 
> code.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to