Repository: aurora Updated Branches: refs/heads/master 8f5a59164 -> cdc5b8efd
Remove psutil's oneshot After a lot of testing on busy machines, I realized that psutil's oneshot is not threadsafe. I contacted the developer however, have not recevied a conceret fix. Please read https://issues.apache.org/jira/browse/AURORA-1939 and https://github.com/giampaolo/psutil/issues/1110 for more information. These inconsistencies disappear after removing oneshot. Reviewed at https://reviews.apache.org/r/61016/ Project: http://git-wip-us.apache.org/repos/asf/aurora/repo Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/cdc5b8ef Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/cdc5b8ef Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/cdc5b8ef Branch: refs/heads/master Commit: cdc5b8efd5bb86d38f73cca6d91903078b120333 Parents: 8f5a591 Author: Reza Motamedi <[email protected]> Authored: Sat Jul 22 20:28:50 2017 +0200 Committer: Stephan Erb <[email protected]> Committed: Sat Jul 22 20:28:50 2017 +0200 ---------------------------------------------------------------------- .../monitoring/process_collector_psutil.py | 23 ++++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/aurora/blob/cdc5b8ef/src/main/python/apache/thermos/monitoring/process_collector_psutil.py ---------------------------------------------------------------------- diff --git a/src/main/python/apache/thermos/monitoring/process_collector_psutil.py b/src/main/python/apache/thermos/monitoring/process_collector_psutil.py index 3594955..3000e95 100644 --- a/src/main/python/apache/thermos/monitoring/process_collector_psutil.py +++ b/src/main/python/apache/thermos/monitoring/process_collector_psutil.py @@ -27,18 +27,17 @@ from .process import ProcessSample def process_to_sample(process): """ Given a psutil.Process, return a current ProcessSample """ try: - with process.oneshot(): - # the nonblocking get_cpu_percent call is stateful on a particular Process object, and hence - # >2 consecutive calls are required before it will return a non-zero value - rate = process.cpu_percent(0.0) / 100.0 - cpu_times = process.cpu_times() - user, system = cpu_times.user, cpu_times.system - memory_info = process.memory_info() - rss, vms = memory_info.rss, memory_info.vms - nice = process.nice() - status = process.status() - threads = process.num_threads() - return ProcessSample(rate, user, system, rss, vms, nice, status, threads) + # the nonblocking get_cpu_percent call is stateful on a particular Process object, and hence + # >2 consecutive calls are required before it will return a non-zero value + rate = process.cpu_percent(0.0) / 100.0 + cpu_times = process.cpu_times() + user, system = cpu_times.user, cpu_times.system + memory_info = process.memory_info() + rss, vms = memory_info.rss, memory_info.vms + nice = process.nice() + status = process.status() + threads = process.num_threads() + return ProcessSample(rate, user, system, rss, vms, nice, status, threads) except (AccessDenied, NoSuchProcess) as e: log.debug('Error during process sampling [pid=%s]: %s' % (process.pid, e)) return ProcessSample.empty()
