mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
Fix lock rpc server maintenance loop go-routine leak (#5423)
The problem was after the globalServiceDoneCh receives a message, we cleanly stop the ticker as expected. But the go-routine where the `select` loop is running is never returned from. The stage at which point this may occur i.e server is being restarted, doesn't seriously affect servers usage. But any build up like this on server has consequences as the new functionality would come in future.
This commit is contained in:
parent
1c3f55ff64
commit
b6e4f053a3
@ -76,11 +76,12 @@ func startLockMaintenance(lockServers []*lockServer) {
|
||||
for {
|
||||
// Verifies every minute for locks held more than 2minutes.
|
||||
select {
|
||||
case <-globalServiceDoneCh:
|
||||
// Stop the timer upon service closure and cleanup the go-routine.
|
||||
ticker.Stop()
|
||||
return
|
||||
case <-ticker.C:
|
||||
lk.lockMaintenance(lockValidityCheckInterval)
|
||||
case <-globalServiceDoneCh:
|
||||
// Stop the timer.
|
||||
ticker.Stop()
|
||||
}
|
||||
}
|
||||
}(locker)
|
||||
|
Loading…
Reference in New Issue
Block a user