Attending this event?
Back To Schedule
Saturday, January 29 • 3:00pm - 3:50pm
Shutting down goroutines gracefully

Sign up or log in to save this to your schedule, view media, leave feedback and see who's attending!

Go makes it easy for us to do concurrent background tasks - but what happens when the application stops? In this talk, we will have some fun with signals, how to make your Go application listen to those signals and stop gracefully, and how to make sure any background work running in your production containers don't stop abruptly with the help of channels.

This is a real scenario, extracted from a work environment and a real problem to a talk format, and the first few examples will explain the problem and when it'll show up and impact your users and customers before we dive into the solution.

In order to make sure everyone is in the same page, an introduction to how Go routines and channels work will be given, with a brief explanation of what is concurrency and parallelism. Following this introduction, a few important POSIX signals will also be introduced briefly because they'll be important in the next section. Background knowledge on all of this is not necessary, but if the audience knows it previously the following contents will be easier to grasp. If not, they'll probably be a good overview but the contents can be used for further review in the future after the knowledge about concurrency, parallelism and signals are well settled into their brain.

Then we will have a walk-through on how to use channels to listen to interrupt signals and wrap up running work on go routines and how to make this work in real-world scenario, with containers and with a example on how this can be done inside of a Kubernetes cluster to finish running go routines during the termination grace period of pods.

A live demo will be followed and we will live code this solution and see it working (hopefully) on a running Kubernetes cluster.

The base repository for this demo and this talk is this one: [github.com/biancarosa/shutting-down-gracefully](http://github.com/biancarosa/shutting-down-gracefully).


Bianca Rosa

Senior Software Engineer, Red Hat
Software Engineer that likes open source, linux, containers, Python and Go.

Saturday January 29, 2022 3:00pm - 3:50pm CET
Session Room 3