Confluence crashes due to CodeCache is full. Compiler has been disabled.
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
The instance may crash, become slow or unresponsive.
The following appears in catalina.out
Java HotSpot(TM) 64-Bit Server VM warning: CodeCache is full. Compiler has been disabled.
Java HotSpot(TM) 64-Bit Server VM warning: Try increasing the code cache size using -XX:ReservedCodeCacheSize=
CodeCache: size=245760Kb used=243892Kb max_used=243931Kb free=1867Kb
bounds [0x00007faa3b170000, 0x00007faa4a170000, 0x00007faa4a170000]
total_blobs=45719 nmethods=44096 adapters=1528
compilation: disabled (not enough contiguous free space left)
When reviewing thread dumps with the following top
output
top -n1 -b -H
The thread dumps for the threads with high CPU % are linked to
"C2 CompilerThread0" daemon prio=10 tid=0x00007fde30e8c800 nid=0xc3e5 runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
Cause
This issue is rare but it can occasionally happen when the Java CodeCache becomes full. A full explanation of this issue can be read
We have also been seeing this value need to be increased when using Java 8.
Resolution
Add the following arguments to the Java startup options by following the instructions on Setting Properties and Options on Startup:
-XX:ReservedCodeCacheSize=384m -XX:+UseCodeCacheFlushing
- Restart the application for the new settings to take effect.