1
0
Fork 0

Fix a rare crash when restarting a system task after shutdown was called

This commit is contained in:
Gregory Eremin 2016-01-10 14:52:32 +03:00
parent 1844832255
commit 1c1140f4f3
1 changed files with 10 additions and 0 deletions

View File

@ -143,6 +143,16 @@ func (s *Satan) processTask(t *task) {
}
func (s *Satan) processSystemTask(t *task) {
// Abort starting a system task if shutdown was already called. Otherwise
// incrementing a wait group counter will cause a panic. This should be an
// extremely rare scenario when a system task crashes and tries to restart
// after a shutdown call.
select {
case <-s.shutdownSystem:
return
default:
}
s.wgSystem.Add(1)
defer s.wgSystem.Done()
defer func() {