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

New shutdown flag gives confusing error message #1885

Closed
Stono opened this issue Aug 9, 2023 · 1 comment · Fixed by #1902
Closed

New shutdown flag gives confusing error message #1885

Stono opened this issue Aug 9, 2023 · 1 comment · Fixed by #1902
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

@Stono
Copy link

Stono commented Aug 9, 2023

Bug Description

Using the new --exit-zero-on-sigterm does correctly exit with a 0, but gives you an incorrect error:

❯ ./cloud-sql-proxy blah:blah --port=3306 --exit-zero-on-sigterm
2023/08/09 22:05:34 Authorizing with Application Default Credentials
2023/08/09 22:05:34 [blah:blah] Listening on 127.0.0.1:3306
2023/08/09 22:05:34 The proxy has started successfully and is ready for new connections!
2023/08/09 22:05:36 The proxy has encountered a terminal error: SIGTERM signal received

❯ echo $?
0
❯ ./cloud-sql-proxy blah:blah --port=3306 
2023/08/09 22:05:34 Authorizing with Application Default Credentials
2023/08/09 22:05:34 [blah:blah] Listening on 127.0.0.1:3306
2023/08/09 22:05:34 The proxy has started successfully and is ready for new connections!
2023/08/09 22:06:14 SIGTERM signal received. Shutting down...

❯ echo $?
143

So we're correctly getting a 0, but equally it's logging an ERROR The proxy has encountered a terminal error: SIGTERM signal received which feels wrong.

Structured logs shows the log level too:

{"severity":"INFO","timestamp":"2023-08-09T22:10:21.009+0100","message":"Authorizing with Application Default Credentials"}
{"severity":"INFO","timestamp":"2023-08-09T22:10:21.177+0100","message":"[blah:blah] Listening on 127.0.0.1:3306"}
{"severity":"INFO","timestamp":"2023-08-09T22:10:21.177+0100","message":"The proxy has started successfully and is ready for new connections!"}
{"severity":"ERROR","timestamp":"2023-08-09T22:10:22.965+0100","message":"The proxy has encountered a terminal error: SIGTERM signal received"}

In both shutdown scenarios, the message should be 2023/08/09 22:06:14 SIGTERM signal received. Shutting down...

Example code (or command)

No response

Stacktrace

No response

Steps to reproduce?

See above

Environment

  1. OS type and version: macosx
  2. Cloud SQL Proxy version (./cloud-sql-proxy --version): 2.6.0
  3. Proxy invocation command (for example, ./cloud-sql-proxy --port 5432 INSTANCE_CONNECTION_NAME): see above

Additional Details

No response

@Stono Stono added the type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. label Aug 9, 2023
@enocom enocom added the priority: p2 Moderately-important priority. Fix may not be included in next release. label Aug 10, 2023
@enocom
Copy link
Member

enocom commented Aug 10, 2023

Thanks, @Stono. We'll fix this.

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
Development

Successfully merging a pull request may close this issue.

4 participants