0

I encounter a "strange" behaviour with an Alfresco instance running on Java8. From time to time, the app uses all the available RAM and lead to OOM exception. We made a HeapDump to see what's happening and the process of making the dump relases the main part of the used memmory. Any idea of what's happening there ?

enter image description here

Each time we perform a dump, the memory is released and go up just after. I cannot understand le logic behind this behaviour enter image description here

FKA
  • 31
  • 5
  • Seems related to this thread : https://stackoverflow.com/questions/5403161/can-jvisualvm-heap-dump-button-release-memory. Should we force GC or look into anoyther direction ? – FKA Oct 14 '20 at 07:20
  • Are you sure that your application won't use such a memory? May be you upload very large files or create thousands/millions of heavy classes depending on some conditions etc? – Onur Baştürk Oct 14 '20 at 07:31
  • The application can use a lot of memory but why, each time, we dump the heap, all the memory is released ? To my understanding, the GC releases unreferenced memory which means that the memory is not more needed by the app. Folowing up on my initital question, each time we dump, the memory goes down and just after it starts to go up again. What would be the meaning of this ? – FKA Oct 14 '20 at 07:43
  • Do you dump it manually or automatically with java -XX:+HeapDumpOnOutOfMemoryError? – Onur Baştürk Oct 14 '20 at 08:12
  • I dump with VisualVM Heap Dump functionnality – FKA Oct 14 '20 at 08:13
  • I plan to use -XX:+HeapDumpOnOutOfMemoryError but we haven't had any recent OOM Exception – FKA Oct 14 '20 at 08:14
  • I see! Yeah it's better to use it on production – Onur Baştürk Oct 14 '20 at 08:16
  • May be dumping process would also require lots of memory, because it produces a large file output. Then you can encounter such a behaviour at the time you dump! – Onur Baştürk Oct 14 '20 at 08:19
  • 1
    Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/223007/discussion-between-fka-and-onur-basturk). – FKA Oct 14 '20 at 08:26
  • Which java process is behaving like this? Alfresco repository or solr? Which Alfresco version? If it is the repo process you would generally find the answer in the access logs and sometimes in the catalina.out. – Heiko Robert Oct 16 '20 at 05:38
  • From what I can see in JProfiler, it's the "SOLRTrackingComponentImpl.java" that goes crazy (both memory and CPI wise). We've implemented a sophisticated Group based security management common to more than 200 Alfresco sites. I tend to think that it was a mistake. We're going back on this strategy to check if it's the root cause – FKA Oct 16 '20 at 13:31

1 Answers1

0

Whenever you try to take a heap dump from visualvm, it first:

  • Triggers a Full Garbage Collection to clear the "dead" objects. Occurrences can be found by searching "Full GC (Heap Dump Initiated GC)" in your garbage collection log.
  • Dump rest of the "live" objects to a file.

That is the reason, whenever you took heap dumps, actual heap utilization came down. That also indicates, you may not having memory leak or other issue which usually leads to OutOfMemory in the environment where you took heap dumps.

I will suggest to use following JVM arguments which are very helpful troubleshooting OutOfMemory errors:

-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=C:\path_where_heap_dumps_will_be_generated
-XX:OnOutOfMemoryError=do_something_to_recover_from_it

Please see this doc for details.

Dharman
  • 30,962
  • 25
  • 85
  • 135
suv3ndu
  • 221
  • 5
  • 12
  • I've done that. The OOM does not occur anymore. We have performed changes in the way we handle security in Alfresco. The situation is better but still awkward memory wise – FKA Oct 16 '20 at 13:26