mom file descriptor leak on resourcedef update when mom hooks present

Description

There's a file descriptor leak in get_resources_from_file(). It opens the resourcedef file, but it doesn't appear to close it.

have a mom hook:

[root@centos7 pbspro-master]# qmgr -c "p h"
#

  1. Create hooks and set their properties.
    #
    #

  2. Create and define hook bar
    #
    create hook bar
    set hook bar type = site
    set hook bar enabled = true
    set hook bar event = execjob_prologue
    set hook bar user = pbsadmin
    set hook bar alarm = 30
    set hook bar order = 1
    set hook bar debug = false
    set hook bar fail_action = none
    import hook bar application/x-python base64 -
    aW1wb3J0IHBicwojbm9vcAojbm9vcAojbm9vcAojbm9vcAo=

import hook bar application/x-config base64 -

update resourcedef with qmgr:

[root@centos7 pbspro-master]# qmgr -c "c r foo5"
[root@centos7 pbspro-master]# ls -l /proc/$(pgrep pbs_mom)/fd | grep resourcedef
lr-x------. 1 root root 64 Sep 11 15:07 14 -> /var/spool/pbs/mom_priv/hooks/resourcedef
lr-x------. 1 root root 64 Sep 11 15:07 15 -> /var/spool/pbs/mom_priv/hooks/resourcedef
[root@centos7 pbspro-master]# qmgr -c "s r foo5 type=long"
[root@centos7 pbspro-master]# ls -l /proc/$(pgrep pbs_mom)/fd | grep resourcedef
lr-x------. 1 root root 64 Sep 11 15:07 14 -> /var/spool/pbs/mom_priv/hooks/resourcedef
lr-x------. 1 root root 64 Sep 11 15:07 15 -> /var/spool/pbs/mom_priv/hooks/resourcedef
lr-x------. 1 root root 64 Sep 11 15:07 16 -> /var/spool/pbs/mom_priv/hooks/resourcedef
lr-x------. 1 root root 64 Sep 11 15:07 17 -> /var/spool/pbs/mom_priv/hooks/resourcedef
[root@centos7 pbspro-master]# qmgr -c "s r foo5 flag=hn"
[root@centos7 pbspro-master]# ls -l /proc/$(pgrep pbs_mom)/fd | grep resourcedef
lr-x------. 1 root root 64 Sep 11 15:07 14 -> /var/spool/pbs/mom_priv/hooks/resourcedef
lr-x------. 1 root root 64 Sep 11 15:07 15 -> /var/spool/pbs/mom_priv/hooks/resourcedef
lr-x------. 1 root root 64 Sep 11 15:07 16 -> /var/spool/pbs/mom_priv/hooks/resourcedef
lr-x------. 1 root root 64 Sep 11 15:07 17 -> /var/spool/pbs/mom_priv/hooks/resourcedef
lr-x------. 1 root root 64 Sep 11 15:07 18 -> /var/spool/pbs/mom_priv/hooks/resourcedef
lr-x------. 1 root root 64 Sep 11 15:07 19 -> /var/spool/pbs/mom_priv/hooks/resourcedef
[root@centos7 pbspro-master]#

Acceptance Criteria

None

Status

Assignee

Ashwath Rao P

Reporter

Scott Campbell

Severity

3-High

OS

None

Start Date

None

Pull Request URL

None

Story Points

1

Components

Priority

Blocker
Configure