2

When investigating why my tomcat 8 server on Ubuntu 15 not responding on start-up, it turns out that it spends huge amount of time trying to create an instance of SecureRandom. Why is that the case and how to fix?

May 19, 2016 2:48:22 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
May 19, 2016 3:21:37 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
!!! ----> INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [1,994,925] milliseconds.
May 19, 2016 3:21:37 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /var/lib/tomcat8/webapps/ROOT has finished in 1,995,782 ms
May 19, 2016 3:21:37 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
May 19, 2016 3:21:37 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1995884 ms
teddy
  • 2,158
  • 4
  • 26
  • 34

1 Answers1

2

As per Javadoc

Depending on the implementation, the {@code generateSeed} and {@code nextBytes} methods may block as entropy is being gathered, for example, if they need to read from /dev/random on various Unix-like operating systems.

Could you check if /dev/random is not slow, it may be secureRandom is using NativePRNG (/dev/random)?

For more detail about reasons /dev/random can be slow refer to /dev/random Extremely Slow?

Community
  • 1
  • 1
Manoj
  • 59
  • 2