-
Notifications
You must be signed in to change notification settings - Fork 343
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
Unexpected Exit Code 1 on SIGTERM Signal Handling in nginx-prometheus-exporter #543
Comments
The issue was not reproducible with the container image tagged "edge" and the binary from the latest master branch code.
This returns 0 when a TERM signal is sent. |
Hi @knziiy Thanks for reporting this, it seems like this will be fixed once we release |
@lucacome
If this is going to be fixed in the next release, then I would like to close this issue. |
Yeah what's in |
@knziiy https://github.com/nginxinc/nginx-prometheus-exporter/releases/tag/v1.0.0 is out if you want to give it a try |
I'm pleased to confirm that the issue I was experiencing has been resolved with the new 1.0.0 version of nginx-prometheus-exporter. I appreciate the efforts and the update provided. |
Description
I've encountered an issue with the nginx-prometheus-exporter where it returns an exit code of 1 when handling the SIGTERM signal, despite explicitly calling
os.Exit(0)
in the signal handler. This behavior is unexpected and seems to contradict the standard exit code practices for SIGTERM handling.Environment
Steps to Reproduce
Expected Behavior
The exporter should exit with a code of 0 when a SIGTERM signal is received, as per the standard Unix signal handling.
Actual Behavior
The exporter logs indicate the SIGTERM signal is received and handled correctly, with the log messages showing the steps of closing the server and exiting the program with
os.Exit(0)
. However, the actual exit code of the process is 1.Debugging Steps
To investigate this issue, I added additional debug logging in the signal handling portion of the code. The modified signal handler code logs the process of receiving the signal, closing the server, and calling
os.Exit(0)
:Logs
Exit Code: 1 (Checked using
echo $?
)Additional Context
This issue is critical as it affects the expected behavior in containerized environments, especially in orchestration platforms like Kubernetes or AWS ECS, where the exit code is used to determine the container's state.
The debug logging confirms that the signal handling path is executed as expected, but the exit code does not reflect the
os.Exit(0)
call. The issue persists across different environments and seems to be specific to the way SIGTERM is handled in the exporter.Any guidance or insights into this issue would be greatly appreciated.
The text was updated successfully, but these errors were encountered: