Browse Source

etcd-tester: cancel lease stream; fix OOM panic

It was never closing lease keep-alive streams, leaking memory.
Fix OOM panics in etcd-tester (after 1K rounds).
Gyu-Ho Lee 9 years ago
parent
commit
301abddc72
1 changed files with 1 additions and 0 deletions
  1. 1 0
      tools/functional-tester/etcd-tester/lease_stresser.go

+ 1 - 0
tools/functional-tester/etcd-tester/lease_stresser.go

@@ -266,6 +266,7 @@ func (ls *leaseStresser) keepLeaseAlive(leaseID int64) {
 	defer ls.aliveWg.Done()
 	defer ls.aliveWg.Done()
 	ctx, cancel := context.WithCancel(ls.ctx)
 	ctx, cancel := context.WithCancel(ls.ctx)
 	stream, err := ls.lc.LeaseKeepAlive(ctx)
 	stream, err := ls.lc.LeaseKeepAlive(ctx)
+	defer func() { cancel() }()
 	for {
 	for {
 		select {
 		select {
 		case <-time.After(500 * time.Millisecond):
 		case <-time.After(500 * time.Millisecond):