# [Solved] Tomcat on Icedtea only answers during shutdown?!

## Cygon

I'm setting up a new Gentoo server on which I plan to run Jenkins (a Java webapp) through Tomcat.

At first, everything worked fine - I've set up the tomcat instance, the host manager showed, I installed Jenkins and it launched without a hitch. Then I restarted Jenkins and things went downhill from there:

- First, Jenkins (the deployed webapp) would not complete its restart

- Tomcat manager app showed 5 sessions and would time out when I hit 'Stop'

- After restarting tomcat itself, the Tomcat manager app still showed 5 Jenkins sessions

- After hitting 'Stop' a few times, the Tomcat manager app stopped responding

- Even after restarting tomcat, I get no HTTP response from Tomcat at all

- ...except: during shutdown. If I issue an HTTP request and then shut down Tomcat, it will be served.

I have erased every trace of Jenkins, I have removed and recreated my tomcat instance, I have restarted the server and nothing changed.

I've set all Tomcat logging options to 'FINE' (meaning debug/verbose). There is nothing useful at all in the logs. Normal startup without errors, tomcat process is running, HTTP requests time out & do *not* get logged. If I shut down Tomcat while a HTTP request is still waiting, then it does get logged.[/code]

```
8 core Opteron, AMD64, 32 GB RAM

Gentoo 4.1.15-r1

Tomcat 8.0.30

Tomcat-native 1.2.4

Icedtea-7.2.6.4-r1
```

Grateful for any idea or suggestion...Last edited by Cygon on Tue Mar 01, 2016 6:01 pm; edited 1 time in total

----------

## Cygon

Observations:

- it's running fine on another server, though that one is x86

- very sporadically it does begin to work. One running, it's fast and reliable.

- here's one instance of it suddenly starting to work after doing nothing for 8 minutes with 0% CPU usage.

```
28-Feb-2016 13:36:10.214 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.30-gentoo

28-Feb-2016 13:36:10.216 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Feb 28 2016 13:33:17 UTC

28-Feb-2016 13:36:10.217 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.30

28-Feb-2016 13:36:10.217 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux

28-Feb-2016 13:36:10.217 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            4.1.15-gentoo-r1

28-Feb-2016 13:36:10.217 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64

28-Feb-2016 13:36:10.218 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /usr/lib64/icedtea7/jre

28-Feb-2016 13:36:10.218 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.7.0_95-b00

28-Feb-2016 13:36:10.218 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation

28-Feb-2016 13:36:10.218 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /var/lib/tomcat-8-jenkins

28-Feb-2016 13:36:10.219 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /usr/share/tomcat-8

28-Feb-2016 13:36:10.219 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager

28-Feb-2016 13:36:10.220 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/var/lib/tomcat-8-jenkins/conf/logging.properties

28-Feb-2016 13:36:10.220 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/var/lib/tomcat-8-jenkins

28-Feb-2016 13:36:10.220 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/share/tomcat-8

28-Feb-2016 13:36:10.220 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/var/tmp/tomcat-8-jenkins

28-Feb-2016 13:36:10.220 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dgentoo.classpath=/usr/share/eclipse-ecj-4.4/lib/ecj.jar,/usr/share/oracle-javamail/lib/mail.jar,/usr/share/tomcat-servlet-api-3.1/lib/el-api.jar,/usr/share/tomcat-servlet-api-3.1/lib/jsp-api.jar,/usr/share/tomcat-servlet-api-3.1/lib/servlet-api.jar

28-Feb-2016 13:36:10.221 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library 1.2.4 using APR version 1.5.2.

28-Feb-2016 13:36:10.221 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].

28-Feb-2016 13:36:10.226 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized (OpenSSL 1.0.2f  28 Jan 2016)

28-Feb-2016 13:36:10.376 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-apr-8080"]

28-Feb-2016 13:36:10.403 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-apr-8009"]

28-Feb-2016 13:36:10.408 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1263 ms

28-Feb-2016 13:36:10.465 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina

28-Feb-2016 13:36:10.465 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.30-gentoo

28-Feb-2016 13:36:10.482 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor /etc/tomcat-8-jenkins/Catalina/localhost/host-manager.xml

28-Feb-2016 13:36:11.670 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars 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.

28-Feb-2016 13:44:50.732 INFO [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [519,017] milliseconds.

28-Feb-2016 13:44:50.772 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor /etc/tomcat-8-jenkins/Catalina/localhost/host-manager.xml has finished in 520,290 ms

28-Feb-2016 13:44:50.773 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor /etc/tomcat-8-jenkins/Catalina/localhost/manager.xml

28-Feb-2016 13:44:51.204 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars 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.

28-Feb-2016 13:44:51.211 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor /etc/tomcat-8-jenkins/Catalina/localhost/manager.xml has finished in 438 ms

28-Feb-2016 13:44:51.213 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /var/lib/tomcat-8-jenkins/webapps/ROOT

28-Feb-2016 13:44:51.605 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars 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.

28-Feb-2016 13:44:51.612 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /var/lib/tomcat-8-jenkins/webapps/ROOT has finished in 399 ms

28-Feb-2016 13:44:51.617 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-apr-8080"]

28-Feb-2016 13:44:51.628 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-apr-8009"]

28-Feb-2016 13:44:51.629 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 521220 ms
```

Some googling revealed that tomcat may need some entropy for the RNG to start up. Since it's idling at 0% CPU and takes crazy long, that's my best bet.

I'll update this thread if that's the problem (in that case it would have been reeally nice of Tomcat could just write a single line into the log saying "waiting for entropy" or something :p)

----------

## Cygon

Okay, it really was my system running out of entropy.

```
cat /proc/sys/kernel/random/entropy_avail
```

shows it going down to zero (or just a few bytes), causing some disk activity

```
du / -h
```

will fill the entropy pool and allow TomCat to launch.[/code]

----------

