Confluence is causing large CPU usage spikes intermittently on Windows

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Server and Data Center Only. This article only applies to Atlassian products on the server and data center platforms.

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:

"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).

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
Last modified on Feb 26, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.