{"action":"created","issue":{"url":"https://api.github.com/repos/avocado-framework/avocado/issues/2135","repository_url":"https://api.github.com/repos/avocado-framework/avocado","labels_url":"https://api.github.com/repos/avocado-framework/avocado/issues/2135/labels{/name}","comments_url":"https://api.github.com/repos/avocado-framework/avocado/issues/2135/comments","events_url":"https://api.github.com/repos/avocado-framework/avocado/issues/2135/events","html_url":"https://github.com/avocado-framework/avocado/issues/2135","id":249309991,"number":2135,"title":"Profilers do not clean up after the avocado run finishes. ","user":{"login":"Venutiwa","id":30831822,"avatar_url":"https://avatars3.githubusercontent.com/u/30831822?v=4","gravatar_id":"","url":"https://api.github.com/users/Venutiwa","html_url":"https://github.com/Venutiwa","followers_url":"https://api.github.com/users/Venutiwa/followers","following_url":"https://api.github.com/users/Venutiwa/following{/other_user}","gists_url":"https://api.github.com/users/Venutiwa/gists{/gist_id}","starred_url":"https://api.github.com/users/Venutiwa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Venutiwa/subscriptions","organizations_url":"https://api.github.com/users/Venutiwa/orgs","repos_url":"https://api.github.com/users/Venutiwa/repos","events_url":"https://api.github.com/users/Venutiwa/events{/privacy}","received_events_url":"https://api.github.com/users/Venutiwa/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2017-08-10T11:00:34Z","updated_at":"2017-08-22T13:01:54Z","closed_at":null,"body":"Profilers added in /etc/avocado/sysinfo/profilers keep running even after the avocado run finishes, filling up the 100% of the disk space. profilers should get cleaned/killed once the test completes.\r\nsample ps -ef output after avocado-setup.py exit:\r\nroot 170073 2 0 02:40 ? 00:00:00 [kworker/0:2]\r\nroot 170309 1 0 04:08 pts/0 00:00:02 iostat -t -x 5\r\nroot 170316 1 0 04:08 pts/0 00:00:00 vmstat -t 5\r\nroot 170319 1 1 04:08 pts/0 00:00:15 top -b -d 5 -H\r\nroot 170329 1 0 04:08 pts/0 00:00:01 iostat -t 5\r\nroot 170341 1 0 04:08 pts/0 00:00:03 mpstat -P ALL 5\r\nroot 170646 81014 0 04:08 ? 00:00:00 sshd: root@pts/5\r\nOne has to manually kill the profilers after each run. It is bit severe as the test unattended would pull the SUT down due to / getting filled."},"comment":{"url":"https://api.github.com/repos/avocado-framework/avocado/issues/comments/324018916","html_url":"https://github.com/avocado-framework/avocado/issues/2135#issuecomment-324018916","issue_url":"https://api.github.com/repos/avocado-framework/avocado/issues/2135","id":324018916,"user":{"login":"apahim","id":4717757,"avatar_url":"https://avatars3.githubusercontent.com/u/4717757?v=4","gravatar_id":"","url":"https://api.github.com/users/apahim","html_url":"https://github.com/apahim","followers_url":"https://api.github.com/users/apahim/followers","following_url":"https://api.github.com/users/apahim/following{/other_user}","gists_url":"https://api.github.com/users/apahim/gists{/gist_id}","starred_url":"https://api.github.com/users/apahim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apahim/subscriptions","organizations_url":"https://api.github.com/users/apahim/orgs","repos_url":"https://api.github.com/users/apahim/repos","events_url":"https://api.github.com/users/apahim/events{/privacy}","received_events_url":"https://api.github.com/users/apahim/received_events","type":"User","site_admin":false},"created_at":"2017-08-22T13:01:54Z","updated_at":"2017-08-22T13:01:54Z","body":"Ok, even though I cannot reproduce, I have a good idea on what´s happening. I see your system is creating the calling `/bin/sh` to execute the commands, which are executed in a subprocess. When we terminate the profiler we are in fact terminating the `/bin/sh` and not the subprocess created by it.\r\nTo prove my theory, I'd like to request you to make a little change in the `sysinfo.py` source code:\r\n\r\n```diff\r\ndiff --git a/avocado/core/sysinfo.py b/avocado/core/sysinfo.py\r\nindex 3e145ba5..56e5826d 100644\r\n--- a/avocado/core/sysinfo.py\r\n+++ b/avocado/core/sysinfo.py\r\n@@ -16,6 +16,7 @@ import gzip\r\n import json\r\n import logging\r\n import os\r\n+import shlex\r\n import shutil\r\n import time\r\n import threading\r\n@@ -222,8 +223,8 @@ class Daemon(Command):\r\n         logf_path = os.path.join(logdir, self.logf)\r\n         stdin = open(os.devnull, \"r\")\r\n         stdout = open(logf_path, \"w\")\r\n-        self.pipe = subprocess.Popen(self.cmd, stdin=stdin, stdout=stdout,\r\n-                                     stderr=subprocess.STDOUT, shell=True, env=env)\r\n+        self.pipe = subprocess.Popen(shlex.split(self.cmd), stdin=stdin, stdout=stdout,\r\n+                                     stderr=subprocess.STDOUT, shell=False, env=env)\r\n\r\n     def stop(self):\r\n         \"\"\"\r\n```\r\nNotice that the `subprocess.Popen` call  to be changed is the one present in the class `Daemon`.\r\n\r\nDepending on how you've installed Avocado, this file can be in different locations. If you're using it from dnf/rpm, location is `/usr/lib/python2.7/site-packages/avocado/core/sysinfo.py`.\r\n\r\nAfter that change, you can run Avocado again and see what happens. Looking forward to see the results."}}
{"actor":{"display_login":"apahim"}}