# PBS mom hook resetting memory values

**URL:** <https://community.openpbs.org/t/pbs-mom-hook-resetting-memory-values/2172>\
**Category:** Users/Site Administrators\
**Created:** [June 18, 2020, 2:56pm UTC](https://community.openpbs.org/t/pbs-mom-hook-resetting-memory-values/2172 "2020-06-18T14:56:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ndusek](https://avatars.discourse-cdn.com/v4/letter/n/779978/32.png) [@ndusek](https://community.openpbs.org/u/ndusek)\
**Post date:** [June 18, 2020, 2:56pm UTC](https://community.openpbs.org/t/pbs-mom-hook-resetting-memory-values/2172/1 "2020-06-18T14:56:46Z")

</div>

Hello,

We are running into an issue with managing available memory on our compute nodes. In our qmgr config, we set `resources_available.mem` to a lower value (by some fixed amount) than the total physical memory on the machine, in order to prevent the OS from being starved. For example, if a node has 64gb physical memory, we might do something like:

```nohighlight
set node node0001 resources_available.mem = 54gb

```

The problem is, whenever the PBS mom process restarts – either due to a reboot or just a service restart – there is a mom hook that resets the available memory to the total physical memory. From the server logs:

```nohighlight
06/18/2020 09:44:53;0100;Server@bright01;Node;node0001.thunder.ccast;Updated vnode node0001's resource resources_available.mem=65336320kb per mom hook request

```

Can we somehow change this behavior to prevent our memory values from being overwritten?

Thank you,  
Nick

---

<div class="post-metadata">

**Author:** ![vstumpf](https://avatars.discourse-cdn.com/v4/letter/v/dbc845/32.png) [@vstumpf](https://community.openpbs.org/u/vstumpf)\
**Post date:** [June 18, 2020, 10:13pm UTC](https://community.openpbs.org/t/pbs-mom-hook-resetting-memory-values/2172/2 "2020-06-18T22:13:31Z")

</div>

I don’t think there’s a way to prevent hooks from changing the resources on the vnode.

Though I can think of some other fixes:

- edit the hook to not change memory
- create a new hook that runs after the first hook to set the memory to another value

If anyone else has any ideas, please comment

---

<div class="post-metadata">

**Author:** ![ndusek](https://avatars.discourse-cdn.com/v4/letter/n/779978/32.png) [@ndusek](https://community.openpbs.org/u/ndusek)\
**Post date:** [June 19, 2020, 4:35pm UTC](https://community.openpbs.org/t/pbs-mom-hook-resetting-memory-values/2172/3 "2020-06-19T16:35:46Z")

</div>

Thank you for the tips. How would I go about determining which hook is changing the resources, and then how do I change it? We’ve created and deployed custom hooks, so I know the workflow there. But this seems to be caused by a hook that’s part of the default PBS installation. Can you point me to somewhere in the documentation that describes how to do what you’re suggesting?

Nick

---

<div class="post-metadata">

**Author:** ![vstumpf](https://avatars.discourse-cdn.com/v4/letter/v/dbc845/32.png) [@vstumpf](https://community.openpbs.org/u/vstumpf)\
**Post date:** [June 19, 2020, 4:51pm UTC](https://community.openpbs.org/t/pbs-mom-hook-resetting-memory-values/2172/4 "2020-06-19T16:51:44Z")

</div>

The MoM logs should log the hooks being run at a higher log level, I’m not sure the exact level on the top of my head, but for debugging 0xffff always works. (8.10 in the Hooks guide, Error Reporting and Logging)

Do you have the cgroups hook enabled? If it’s set to create vnodes, it will use all the available memory on the machine. You can edit this with the cgroup’s config file with the keys ‘reserve\_amount’ and ‘reserve\_percent’. (15.4 in the Admin guide, Configuring Cgroups)
