RepositoryQuerySession Memory Leak

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Member II

RepositoryQuerySession Memory Leak

Hi, I'm running a v4.2.0 on a Tomcat 7.0.64 with 1GB of max Heap space.

I've no problems for years, but in last weeks it ran in out of memory almost once a day.

I took some heap dump and made some tests, and I found the class resposible of memory retention:

org.alfresco.repo.webservice.repository.RepositoryQuerySession

Every time a document is saved in Alfresco by a thirdparty software (via WS), two new instances of RepositoryQuerySession are created in memory, and never removed.

And these objects retains op to 5MB each.

GC is called but they stay there. 

 

The problem does not apper when documents are uploaded throgh Alfresco web interface.

Unfortunatly I've no acces on that thirdparty sotware.

So what could keep alive these RepositoryQuerySession objects?

3 Replies
Highlighted
Master

Re: RepositoryQuerySession Memory Leak

Instances of RepositoryQuerySession are retained within the Repository 2nd-level cache named "webServicesQuerySessionSharedCache", which can be configured via the alfresco-global.properties file. By default, the cache allows up to 1000 objects to be cached. Cached objects are not cleared during GC, so it is important to correctly configure the cache sizes when using extremely little memory (1GiB max heap is extremely little for Alfresco).

Highlighted
Member II

Re: RepositoryQuerySession Memory Leak

Thanks a lot Axel

I set

cache.webServicesQuerySessionSharedCache.maxItems=50

in my alfresco-global.properties and it actually works: the number of RepositoryQuerySession instances grows up to 50 and never exceeds it.

One more question.

I tried also to set

cache.webServicesQuerySessionSharedCache.timeToLiveSeconds=240
cache.webServicesQuerySessionSharedCache.maxIdleSeconds=120

but they seems not applied.

After 2 or 4 mintue of inactivity, my RepositoryQuerySession instances are still present in heap.

Maybe these parameters are not supported in my alfresco version (4.2.0)?

Highlighted
Master

Re: RepositoryQuerySession Memory Leak

Yes, some configuration operations are not supported for all Alfresco versions / editions. There also is a difference if the cache in question is created as a local-only or a cluster-distributed cache in Alfresco Enterprise. In 4.2, timeToLive and maxIdle weren't used for local caches.