File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -1017,7 +1017,7 @@ def stop_scan_cleanup(
10171017 self ,
10181018 kbdb : BaseDB ,
10191019 scan_id : str ,
1020- ovas_process : psutil . Popen , # pylint: disable=arguments-differ
1020+ ovas_pid : str , # pylint: disable=arguments-differ
10211021 ):
10221022 """Set a key in redis to indicate the wrapper is stopped.
10231023 It is done through redis because it is a new multiprocess
@@ -1031,8 +1031,17 @@ def stop_scan_cleanup(
10311031 # Set stop flag in redis
10321032 kbdb .stop_scan (scan_id )
10331033
1034+ try :
1035+ ovas_process = psutil .Process (int (ovas_pid ))
1036+ except psutil .NoSuchProcess :
1037+ ovas_process = None
1038+
10341039 # Check if openvas is running
1035- if ovas_process .is_running ():
1040+ if (
1041+ ovas_process
1042+ and ovas_process .is_running ()
1043+ and ovas_process .name () == "openvas"
1044+ ):
10361045 # Cleaning in case of Zombie Process
10371046 if ovas_process .status () == psutil .STATUS_ZOMBIE :
10381047 logger .debug (
@@ -1066,7 +1075,7 @@ def stop_scan_cleanup(
10661075 logger .debug (
10671076 "%s: Process with PID %s already stopped" ,
10681077 scan_id ,
1069- ovas_process . pid ,
1078+ ovas_pid ,
10701079 )
10711080
10721081 # Clean redis db
You can’t perform that action at this time.
0 commit comments