Supervisors for golang
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gopath/src
docs/dev
example/saltmines
latch
phist
sluice
.gitignore
.gitmodules
LICENSE
README.md
api.go
behaviors.go
circle.yml
context.go
errors.go
example_daemonspawner_test.go
example_test.go
goad
logging.go
logging_test.go
manager.go
manager_internal.go
manager_test.go
writ.go

README.md

SUP

Supervisors for Go(lang).

Why?

Collecting goroutines is important. It's simply systematically sane. Letting goroutines spin off into the distance with no supervision is extremely likely to represent either a resource leak, a missing error handle path, or an outright logic bug.

There's been a litany [1][2] of blogs about this recently, if anyone doesn't consider this self-evident.

In a dream world, we might have Erlang-style supervisor trees so this can all be done with less boilerplate. It's almost even possible to do this as a library in go!

And that's what go-sup is. Supervisor trees as a library.

What this doesn't solve

Quitting is still "cooperative" -- code must be well behaved, and respond to the quit in a reasonable time.

In most situations, well-behaved code is not terribly complicated to write. However, blocking IO often still presents a bit of an issue. Any supervisor of a goroutine that may be IO-blocked may itself be indefinitely stuck, and so on up-tree. Typically this can at least be salved by using timeouts to minimize the worst case for block times.

go-sup will issue warnings messages (the function for this is configurable -- the default is printing to stderr) for tasks that do not return within a reasonable time (2 seconds).