yggdrasil-go
yggdrasil-go copied to clipboard
Finalization Yggdrasil leads to extremely high CPU consumption - possible infinite looping
Finalization Yggdrasil leads to extremely high CPU consumption - possible infinite looping.
Branch: master, fork: https://github.com/vikulin/yggdrasil-extras
The issue found while debug of Yggdrasil Android app. Also it was started after several users complained that switch off button causes high CPU consumption. As result I did profile debug and found following: The CPU starts high load right after Yggdrasil().Stop() call which is modified as following:
// Stop the mobile Yggdrasil instance
func (m *Yggdrasil) Stop() {
logger := log.New(m.log, "", 0)
logger.EnableLevel("info")
logger.Infof("Stop the mobile Yggdrasil instance %s", "")
m.admin.Stop()
m.multicast.Stop()
m.dummy.Stop()
m.core.Stop()
}
The screenshot shows different states before and after the Stop() method invocation in line 256:
Before Stop()
After Stop()
I concern that the method Stop() runs into infinite looping somewhere within child Stop() calls.
Maybe related: if Yggdrasil runs several days long, then stopping takes too much time:
2020/06/23 16:05:43 Starting up...
...
2020/07/04 10:56:01 Stopping multicast module
2020/07/04 10:56:01 Error reading TUN: file already closed
2020/07/04 10:56:11 Stopping...
...
2020/07/04 10:56:12 Stopped
Commenting out m.admin.Stop() solved the issue, continue investigation.
// Stop the mobile Yggdrasil instance
func (m *Yggdrasil) Stop() {
logger := log.New(m.log, "", 0)
logger.EnableLevel("info")
logger.Infof("Stop the mobile Yggdrasil instance %s", "")
//m.admin.Stop()
m.multicast.Stop()
m.dummy.Stop()
m.core.Stop()
}
Found second Stop() method with the same issue: m.dummy.Stop(). I thing this is the end of my research.
Closing as out-of-date.