goroutine leak

A goroutine that never finishes because it is stuck waiting for something that will never happen, slowly wasting memory.

Leaked goroutines accumulate until the service exhausts memory and is killed.

In more detail

Typical causes are sending on a channel nobody reads, or waiting on a network call with no timeout. In a long-running service leaks pile up until the process runs out of memory. Give every goroutine a way to stop, usually a context, and join it before exit.

Related terms

Taught in

References