go-marathon icon indicating copy to clipboard operation
go-marathon copied to clipboard

Test for goroutine leaks

Open msabramo opened this issue 6 years ago • 2 comments

Add goroutine leak testing to tests to probe for goroutine leakage, as mentioned in https://github.com/gambol99/go-marathon/issues/208

In particular:

=== RUN   TestSSEWithManyListeners
--- FAIL: TestSSEWithManyListeners (5.05s)
	leaktest.go:129: leaktest: timed out checking goroutines
	leaktest.go:147: leaktest: leaked goroutine: goroutine 750 [chan receive]:
		github.com/gambol99/go-marathon.(*marathonClient).registerSSESubscription.func1(0xc4203a41e0)
			/home/travis/gopath/src/github.com/gambol99/go-marathon/subscription.go:186 +0x130
		created by github.com/gambol99/go-marathon.(*marathonClient).registerSSESubscription
			/home/travis/gopath/src/github.com/gambol99/go-marathon/subscription.go:181 +0x1a6
	leaktest.go:147: leaktest: leaked goroutine: goroutine 772 [chan receive]:
		github.com/gambol99/go-marathon.(*cluster).healthCheckNode(0xc4200a09c0, 0xc4202c23a0)
			/home/travis/gopath/src/github.com/gambol99/go-marathon/cluster.go:139 +0xee
		created by github.com/gambol99/go-marathon.(*cluster).markDown
			/home/travis/gopath/src/github.com/gambol99/go-marathon/cluster.go:128 +0x186
	leaktest.go:147: leaktest: leaked goroutine: goroutine 774 [chan receive]:
		github.com/gambol99/go-marathon.(*cluster).healthCheckNode(0xc4200a09c0, 0xc4202c23c0)
			/home/travis/gopath/src/github.com/gambol99/go-marathon/cluster.go:139 +0xee
		created by github.com/gambol99/go-marathon.(*cluster).markDown
			/home/travis/gopath/src/github.com/gambol99/go-marathon/cluster.go:128 +0x186
	leaktest.go:147: leaktest: leaked goroutine: goroutine 777 [chan receive]:
		github.com/gambol99/go-marathon.(*cluster).healthCheckNode(0xc4200a09c0, 0xc4202c23e0)
			/home/travis/gopath/src/github.com/gambol99/go-marathon/cluster.go:139 +0xee
		created by github.com/gambol99/go-marathon.(*cluster).markDown
			/home/travis/gopath/src/github.com/gambol99/go-marathon/cluster.go:128 +0x186

illustrates that the number of goroutines will increase if the listeners are not doing their job of consuming events and don't deregister.

Cc: @seanisom, @mayanand, @kmillett

msabramo avatar May 30 '18 21:05 msabramo

CC: @timoreimann @gambol99 @sybrandy @iandyh @marco-jantke

mayanand avatar May 30 '18 21:05 mayanand

LGTM.

iandyh avatar Jun 03 '18 02:06 iandyh