Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Commit

Permalink
Using killpg() instead of kill -9 for orphaned processes
Browse files Browse the repository at this point in the history
  • Loading branch information
PalNilsson committed Sep 20, 2018
1 parent dab1909 commit add11a2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ M movers/mover.py (12)
Code cleanup
- Removed deprecated functions: getTURLFileInfoDic(), updatePFN(), getDefaultStorage() (Mover)

Process kills
- Switched to using killpg() instead of kill -9 in killOrphans(), as suggested by P. McGuigan while
debugging left processes after looping job kill (processes)

Updates from W. Guan:

https://github.com/PanDAWMS/pilot/pull/221
Expand Down
14 changes: 8 additions & 6 deletions processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,14 @@ def killOrphans():
if args.endswith('bash'):
pUtil.tolog("Will not kill bash process")
else:
cmd = 'kill -9 %s' % (pid)
ec, rs = commands.getstatusoutput(cmd)
if ec != 0:
pUtil.tolog("!!WARNING!!2999!! %s" % (rs))
else:
pUtil.tolog("Killed orphaned process %s (%s)" % (pid, args))
os.killpg(pid, signal.SIGKILL)
#cmd = 'kill -9 %s' % (pid)
#ec, rs = commands.getstatusoutput(cmd)
#if ec != 0:
# pUtil.tolog("!!WARNING!!2999!! %s" % (rs))
#else:
# pUtil.tolog("Killed orphaned process %s (%s)" % (pid, args))
pUtil.tolog("Killed orphaned process group %s (%s)" % (pid, args))

if count == 0:
pUtil.tolog("Did not find any orphan processes")
Expand Down

0 comments on commit add11a2

Please sign in to comment.