Closed acabarbaye closed 1 month ago
That is why we introduced xxxWithContext
. We can avoid waiting indefinitely by setting a timeout for a context
. Further, as the author of the library, we cannot set the appropriate wait time. Therefore, we provide a way for library users to set a timeout.
Close for not updating. Feel free to reopen if you have more questions.
Describe the bug
The problem lies in how the commands are spawned in the Invoker https://github.com/shirou/gopsutil/blob/6100124c96d37a9282ca4bf158db8a743e475077/internal/common/common.go#L50 if the spawned command opens I/Os, the
wait()
could block indefinitely. This bug has been reported in many issues with go : https://github.com/golang/go/issues/24050 https://github.com/golang/go/issues/20730 https://github.com/golang/go/issues/23019 https://github.com/golang/go/issues/56187 https://github.com/golang/go/issues/57129 https://github.com/golang/go/issues/60309 https://github.com/golang/go/issues/22485A solution is to set the WaitDelay to ensure wait() returns
To Reproduce the following should block indefinitely
Expected behavior The command above should be terminated if the Timeout is exceeded
Environment (please complete the following information):
ver
]/etc/os-release
and the result ofuname -a
]sw_vers
anduname -a
freebsd-version -k -r -u
anduname -a
]uname -a
]Additional context [Cross-compiling? Paste the command you are using to cross-compile and the result of the corresponding
go env
]