USERSTORE_TOKENPERM growing very fast

Hi folks,

I'm experiencing a very weird problem with userstore_tokenperm clerk recently.

We have an environment with some databases in contained mode executing in version SQL Server 2017. Anyway i'm facing this problem since the SQL Server 2016.

At a certain moment this cache starts to grow at a rate of 6GB by day. When this ocurr we have to do a failover and restart the principal node of AG.

Run DBCC FREESYSTEMCACHE ('TokenAndPermUserStore') does not clear the cache. We are considering to use the trace flags 4621 as suggested by microsoft to avoid this memory pressure, but i want to know if someone has a tip to help me to understand this behavior. This seems like a memory leak, because even running DBCC FREESYSTEMCACHE the objects are not released from memory.

We have around to 70 users in contained mode in this server and when the cache starts to grow it grow until starve the server for memory.

In sys.dm_os_memory_clerks we already faced more than 30GB of consumption

Someone please can help with some troubleshooting hint or even with an experience about this kind of problem.

Thks in advance

Maybe this will help. Solutions are offered in the thread.

1 Like

Thank you so much for your answer.
in fact, we have a database role used by audit software that may be the cause of this problem. it was found on all servers with this kind of problem. I'll dig deeper to see if that's the problem. If I find a solution, I'll post it later.

Thank you.