Univention Bugzilla – Bug 38738
top: NoSuchProcess(pid) Traceback
Last modified: 2017-07-12 16:49:25 CEST
Created attachment 6975 [details] Catch NoSuchProcess exception One of our jenkins tests fails from time to time: <http://jenkins.knut.univention.de:8080/job/UCS-3.2/job/UCS-3.2-6/job/Autotest%20MultiEnv/SambaVersion=s3,Systemrolle=backup/34/testReport/junit/60_umc-system/22_umc-service-proc-killing/test/> > 60_umc-system.22_umc-service-proc-killing.test > Testing UMC process killing with signal 'SIGTERM' > ### FAIL ### > Exception while making 'top/query' request: 500 on backup092 (top/query): {"status": 591, "message": "Die Ausführung des Kommandos top/query ist fehlgeschlagen: > Traceback (most recent call last): > File "PY2.6/univention/management/console/modules/__init__.py", line 218, in execute > func( request ) > File "PY2.6/univention/management/console/modules/decorators.py", line 178, in _response > return function(self, request) > File "PY2.6/univention/management/console/modules/top/__init__.py", line 78, in query > listEntry['mem'] = process.get_memory_percent() > File "PY2.6/psutil/__init__.py", line 342, in get_memory_percent > rss = _platform_impl.get_memory_info(self.pid)[0] > File "PY2.6/psutil/_pslinux.py", line 111, in wrapper > raise NoSuchProcess(pid) > NoSuchProcess: 29728"} > ### ### > Created process with pid '29708' was not terminated, forcing kill Note that the "process to kill"=29708 differs from the "process not found"=29728. The for-loop in management/univention-management-console-module-top/umc/python/top/__init__.py:66 iterates over all processes, but queries the data in a non-atomic way: If *any* process terminates while the loop is iterated, the whole query fails because of a thrown NoSuchProcess exception. All calls to psutils should be wrapped in a try-catch-block.
(In reply to Philipp Hahn from comment #0) > Created attachment 6975 [details] > Catch NoSuchProcess exception > Applied rebased patch: r 80948 univention-management-console-module-top (6.0.1-2) * Bug #38738: Applied patch from Philipp Hahn - Catch NoSuchProcess exception YAML: r 80951
OK: race condition doesn't cause errors anymore OK: YAML (adjusted in r80977)
<http://errata.software-univention.de/ucs/4.2/91.html>