You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2021/03/09 17:11:23 UTC

[trafficserver] branch 9.0.x updated: replace psutil.pid() with psutil.process_iter() for safer execution (#7515)

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 0214e59  replace psutil.pid() with psutil.process_iter() for safer execution (#7515)
0214e59 is described below

commit 0214e599250605cc3f62ff8fe2408c947df7fd7f
Author: Fei Deng <du...@gmail.com>
AuthorDate: Wed Feb 10 21:14:31 2021 -0600

    replace psutil.pid() with psutil.process_iter() for safer execution (#7515)
    
    (cherry picked from commit 6abea9063bfb0fa0b2d398bcf41d341f2e09f694)
---
 tests/gold_tests/thread_config/check_threads.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/gold_tests/thread_config/check_threads.py b/tests/gold_tests/thread_config/check_threads.py
index 7cc46c9..6cc5801 100755
--- a/tests/gold_tests/thread_config/check_threads.py
+++ b/tests/gold_tests/thread_config/check_threads.py
@@ -23,12 +23,11 @@ import sys
 
 def count_threads(ts_path, etnet_threads, accept_threads):
 
-    for pid in psutil.pids():
+    for p in psutil.process_iter(['name', 'cwd', 'threads']):
 
         # Find the pid corresponding to the ats process we started in autest.
         # It needs to match the process name and the binary path.
         # If autest can expose the pid of the process this is not needed anymore.
-        p = psutil.Process(pid)
         if p.name() == '[TS_MAIN]' and p.cwd() == ts_path:
 
             etnet_check = set()