mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 22:56:43 +00:00
Stop execution pool in rpc handler (#1005)
* Stop execution pool in rpc handler All execution pools need to be closed properly. This fixes a potential goroutine leak caused by metric goutine created by each execution pool. * Cancel only once
This commit is contained in:
parent
5fcd45eaf3
commit
fbb9020bec
2 changed files with 6 additions and 2 deletions
|
|
@ -22,6 +22,7 @@ type SafePool struct {
|
|||
processed atomic.Int64 // keeps count of total processed requests
|
||||
|
||||
close chan struct{}
|
||||
closeOnce sync.Once
|
||||
|
||||
// Skip sending task to execution pool
|
||||
fastPath bool
|
||||
|
|
@ -103,7 +104,9 @@ func (s *SafePool) Size() int {
|
|||
}
|
||||
|
||||
func (s *SafePool) Stop() {
|
||||
s.closeOnce.Do(func() {
|
||||
close(s.close)
|
||||
})
|
||||
|
||||
if s.executionPool.Load() != nil {
|
||||
s.executionPool.Load().Stop()
|
||||
|
|
|
|||
|
|
@ -302,6 +302,7 @@ func (h *handler) close(err error, inflightReq *requestOp) {
|
|||
h.callWG.Wait()
|
||||
h.cancelRoot()
|
||||
h.cancelServerSubscriptions(err)
|
||||
h.executionPool.Stop()
|
||||
}
|
||||
|
||||
// addRequestOp registers a request operation.
|
||||
|
|
|
|||
Loading…
Reference in a new issue