Skip to content
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

Accept loop has improper error handling, causing wrong exit code. #2372

Open
hessjcg opened this issue Jan 21, 2025 · 0 comments · May be fixed by #2373
Open

Accept loop has improper error handling, causing wrong exit code. #2372

hessjcg opened this issue Jan 21, 2025 · 0 comments · May be fixed by #2373
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@hessjcg
Copy link
Collaborator

hessjcg commented Jan 21, 2025

When the proxy receives a SIGTERM, it will close this server socket. This can result in the server.Accept() returning a non-nil error with the message
"proxy server error: accept tcp" or "use of closed network connection". This error will be put into the error channel, causing the process end with exit code 2, instead of the appropriate 143 (TERMINATED) or 0 (SUCCESS).

See https://github.com/GoogleCloudPlatform/cloud-sql-proxy/blob/main/cmd/root.go#L1143

@hessjcg hessjcg assigned hessjcg and unassigned jackwotherspoon Jan 21, 2025
@hessjcg hessjcg added the priority: p2 Moderately-important priority. Fix may not be included in next release. label Jan 21, 2025
@hessjcg hessjcg changed the title This may result in an exit code error status Accept loop has improper error handling, causing wrong exit code. Jan 21, 2025
@hessjcg hessjcg added the type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
2 participants