Confluence is causing large CPU usage spikes intermittently on Windows

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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

Summary

Problem

Confluence is causing large CPU spikes intermittently on Windows. Confluence performance becomes slow and sometimes crashes entirely.

Diagnosis

Follow Generating a Thread Dump Externally to generate multiple thread dumps. Check for blocked threads that contain a lock for java.security.SecureRandom

The following is an example blocked thread:

1 2 3 4 5 6 "http-nio-80-exec-7" #166 daemon prio=5 os_prio=0 tid=0x000000002f05e000 nid=0x1764 waiting for monitor entry [0x0000000043323000] java.lang.Thread.State: BLOCKED (on object monitor) at java.security.SecureRandom.nextBytes(Unknown Source) - waiting to lock <0x00000006873088c8> (a java.security.SecureRandom) at java.util.UUID.randomUUID(Unknown Source) at com.atlassian.confluence.content.render.xhtml.editor.macro.DefaultMacroIdSupplier.get(DefaultMacroIdSupplier.java:19)

Cause

There is a known issue with Java and Tomcat in he library used for random number generation in Sun's JVM which relies on /dev/random. This random number generator can block the application server process from starting 'because on some operating systems /dev/random waits for a certain amount of "noise" to be generated on the host machine before returning a result' (see Avoiding JVM Delays Caused by Random Number Generation).

Solution

Workaround

  1. Stop Confluence

  2. Add the flag-Djava.security.egd=file:/dev/urandom to the Java arguments to use dev/urandom by following Configuring System Properties

  3. Start Confluence

Updated on April 2, 2025

Still need help?

The Atlassian Community is here for you.