You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2021/02/10 18:09:13 UTC

[GitHub] [trafficserver] duke8253 opened a new pull request #7515: Replace psutil.pid() with psutil.process_iter() for safer execution

duke8253 opened a new pull request #7515:
URL: https://github.com/apache/trafficserver/pull/7515


   This fixes #7514.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] bneradt commented on pull request #7515: Replace psutil.pid() with psutil.process_iter() for safer execution

Posted by GitBox <gi...@apache.org>.
bneradt commented on pull request #7515:
URL: https://github.com/apache/trafficserver/pull/7515#issuecomment-786837403


   ### 9.0.x and 9.1.x cherry pick justification:
   
   This is a simple test change that merges cleanly to 9.0.x and 9.1.x that makes the thread config tests more stable. I just triaged an autest-9.1.x failure that would have been fixed by this:
   
   https://ci.trafficserver.apache.org/job/autest-9.1.x/9/console
   
   Getting this into these branches will save people time figuring out why it failed.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] duke8253 commented on a change in pull request #7515: Replace psutil.pid() with psutil.process_iter() for safer execution

Posted by GitBox <gi...@apache.org>.
duke8253 commented on a change in pull request #7515:
URL: https://github.com/apache/trafficserver/pull/7515#discussion_r574134169



##########
File path: tests/gold_tests/thread_config/check_threads.py
##########
@@ -23,12 +23,11 @@
 
 def count_threads(ts_path, etnet_threads, accept_threads, task_threads, aio_threads):
 
-    for pid in psutil.pids():
+    for p in psutil.process_iter():

Review comment:
       done




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] bneradt commented on a change in pull request #7515: Replace psutil.pid() with psutil.process_iter() for safer execution

Posted by GitBox <gi...@apache.org>.
bneradt commented on a change in pull request #7515:
URL: https://github.com/apache/trafficserver/pull/7515#discussion_r573966469



##########
File path: tests/gold_tests/thread_config/check_threads.py
##########
@@ -23,12 +23,11 @@
 
 def count_threads(ts_path, etnet_threads, accept_threads, task_threads, aio_threads):
 
-    for pid in psutil.pids():
+    for p in psutil.process_iter():

Review comment:
       Looks good.
   
   As a tweak, reading the docs, it looks like the preferable way to do this is by passing in the subset of process attributes that are desired. In this case, perhaps:
   
   ```
   for p in psutil.process_iter(['name', 'cwd', 'threads']):
      ...
      p.info['name'] == '[TS_MAIN]' and p.info['cwd'] == ts_path:
           ...
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] duke8253 merged pull request #7515: Replace psutil.pid() with psutil.process_iter() for safer execution

Posted by GitBox <gi...@apache.org>.
duke8253 merged pull request #7515:
URL: https://github.com/apache/trafficserver/pull/7515


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] zwoop commented on pull request #7515: Replace psutil.pid() with psutil.process_iter() for safer execution

Posted by GitBox <gi...@apache.org>.
zwoop commented on pull request #7515:
URL: https://github.com/apache/trafficserver/pull/7515#issuecomment-794178304


   Cherry-picked to v9.0.x branch.
   Cherry-picked to v9.1.x branch.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] bneradt commented on a change in pull request #7515: Replace psutil.pid() with psutil.process_iter() for safer execution

Posted by GitBox <gi...@apache.org>.
bneradt commented on a change in pull request #7515:
URL: https://github.com/apache/trafficserver/pull/7515#discussion_r574136455



##########
File path: tests/gold_tests/thread_config/check_threads.py
##########
@@ -23,12 +23,11 @@
 
 def count_threads(ts_path, etnet_threads, accept_threads, task_threads, aio_threads):
 
-    for pid in psutil.pids():
+    for p in psutil.process_iter():

Review comment:
       Great. I'm glad you used p.name rather than p.info['name'] like I suggested. That's much nicer.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org