~/talk

Starting and stopping things

Talkat GopherCon Singapore 2025 · 2025-01-22..01-24· [go, concurrency]
slides:none on file

Goroutines are GC roots so they hold memory until they exit and cannot be forcibly stopped by another goroutine; shutdown is cooperative and must be requested and observed. Demonstrations show a worker loop racing between a closed stop channel and 50 queued jobs, and an HTTP server that spawns detached logging goroutines which pin requests and blow memory. Solution: a group type with Add(ctx -> error) and Wait, using context, SIGTERM-aware parent context, and panic-to-error capture to trigger orderly shutdowns; this groups services so one error or signal cleanly stops the rest.

AI-written summary · about

  1. 0:00Introduction and background
  2. 6:20Goroutines as resources
  3. 10:41Stopping goroutines politely
  4. 15:58Demo on goroutine stopping
  5. 20:32Managing goroutine lifetimes
  6. 23:21History of goroutine management
  7. 27:55Introducing the group library
  8. 33:13Final example and conclusion
  9. 37:00Q&A
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.