gruntwork-io / health-checker

A simple HTTP server that will return 200 OK if all configured health checks pass.
MIT License
103 stars 36 forks source link

script timeout not working #21

Open jsalatiel opened 3 years ago

jsalatiel commented 3 years ago

Hi, I am trying to make the script check timeout within 3 seconds, but apparently it is not working.

How to replicate: Create /tmp/test.sh with the following content:

#!/bin/bash
sleep 30
echo DONE

Now run

 # health-checker_linux_amd64 --log-level debug --script /tmp/test.sh  --script-timeout 3

On another session , run:

# time curl http://localhost:5500
At least one health check failed
real    0m30,021s
user    0m0,011s
sys 0m0,010s

The curl command should give up in 3 seconds, but actually it takes 30 seconds.

The output of health-checker_linux_amd64 shows: INFO[2021-09-05T17:37:43-03:00] The Health Check will attempt to run the following scripts: [{/tmp/test.sh []}] INFO[2021-09-05T17:37:43-03:00] Listening on Port 0.0.0.0:5500...
INFO[2021-09-05T17:37:47-03:00] Received inbound request. Beginning health checks... INFO[2021-09-05T17:37:47-03:00] Executing '{/tmp/test.sh []}' with a timeout of 3 seconds... WARN[2021-09-05T17:38:17-03:00] Script /tmp/test.sh FAILED: signal: killed
WARN[2021-09-05T17:38:17-03:00] Command output:
INFO[2021-09-05T17:38:17-03:00] At least one health check failed. Returning HTTP 504 response.

It took 30 seconds, even though the timeout should be 3 seconds.

jsalatiel commented 3 years ago

Is this still being maintained?

infraredgirl commented 3 years ago

Hi @jsalatiel, this repo is being maintained, however we (Gruntwork) have limited capacity to address issues.

The issue reported here seems to be a legit bug. If you want to submit a PR with a fix, it would be very much appreciated!