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

Cloud Run Graceful Termination Support #1290

Closed
jonahrosenblum opened this issue Jul 8, 2020 · 8 comments · Fixed by #1321
Closed

Cloud Run Graceful Termination Support #1290

jonahrosenblum opened this issue Jul 8, 2020 · 8 comments · Fixed by #1321
Assignees

Comments

@jonahrosenblum
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Google Cloud Run is implementing a new feature to support graceful termination, ideally open telemetry would also support this. In fact, this has already been requested before #523

Describe the solution you'd like

Add process event handlers which will listen for SIGTERM signals sent to the process and initiate the shutdown method, similar to how this has been implemented in Python.

Describe alternatives you've considered

The previous issue suggested something to do with callbacks to ensure all data is processed. I am not sure if concerns over thread blocking are an issue with the main solution I am suggesting.

Additional context

I am thinking of using the nodejs process library for detecting the SIGTERM, and a testing strategy which either involves process forking and/or mocking signals. I would appreciate feedback on the best testing/implementation strategies!

@dyladan
Copy link
Member

dyladan commented Jul 9, 2020

Does #1296 solve your issue?

@jonahrosenblum
Copy link
Contributor Author

I do not think so? I may be misunderstanding what this PR fixes but would this change cause shutdown to be automatically initiated if the process receives a SIGTERM? This is how this feature has been implemented in Python.

@dyladan
Copy link
Member

dyladan commented Jul 9, 2020

ah no. Ok I misunderstood what you were asking for.

@markwolff
Copy link
Member

markwolff commented Jul 9, 2020

Is the Cloud Run using signals to end the process? Is the beforeExit or exit event not sufficient for catching its termination? To me, I would expect data loss when force killing a process, e.g ctrl+c (SIGINT?).

@jonahrosenblum
Copy link
Contributor Author

Currently processed are SIGKILL'ed when an instance is scaled down, the new Cloud Run will send a SIGTERM and allow for a grace period before a SIGKILL is sent. In this period processes should send any data which has not been exported yet. So yes, I believe signals are being used. I do not know much about beforeExit and exit but I assume they would not work in this instance?

@jonahrosenblum
Copy link
Contributor Author

I forgot to ask earlier but could I be assigned to this issue?

@dyladan
Copy link
Member

dyladan commented Jul 13, 2020

done

@jonahrosenblum
Copy link
Contributor Author

@dyladan I believe this issue can be closed now?

@dyladan dyladan closed this as completed Aug 20, 2020
@dyladan dyladan linked a pull request Aug 20, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants