The syscallWatcher today will effectively stack goroutines overtime. At the time of this post the defaultTimeout is 4 minutes which means that all syscalls (even completed ones) will have an open goroutine (although sleeping) for 4 minutes. This pattern should support a context.Context cancellation after a return from a syscall as we no longer need to monitor for a hung state.
It would likely look something like:
ctx, cancel := context.WithTimeout(context.Background(), defautTimeout)
defer cancel()
go syscallWatcher(ctx, ...)
// make syscall
return result
So if the syscall returns we cancel the syscallWatcher and if it times out before returning we get the appropriate syscall hung state as expected.
The
syscallWatchertoday will effectively stack goroutines overtime. At the time of this post thedefaultTimeoutis 4 minutes which means that all syscalls (even completed ones) will have an open goroutine (although sleeping) for 4 minutes. This pattern should support acontext.Contextcancellation after a return from asyscallas we no longer need to monitor for a hung state.It would likely look something like:
So if the syscall returns we cancel the
syscallWatcherand if it times out before returning we get the appropriate syscall hung state as expected.