0

I am experiencing a weird issue on a CentOS 7 virtual machine and I can't see what is causing it.

I created the VM on Digital Ocean and set it up as follows:

1) modified /etc/hostname with myhostname

2) modified /etc/hosts as such

127.0.0.1 localhost.localdomain localhost
127.0.0.1 localhost4.localdomain4 localhost4
123.456.789.123 myhostname.mydomainname.com myhostname


::1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6

3) Configured nginx to reverse proxy

server {
  listen       80;
  server_name  myhostname.mydomainname.com;

  gzip on;

  location / {
    proxy_redirect off;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Server $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass http://localhost:8080/;
  }

}

That's it.

I then downloaded a vanilla Apache Tomcat from https://tomcat.apache.org/ and unpacked in the home of my (non-root) user.

If I run it with startup.sh it seems to get up correctly, however if I try to run

wget http://localhost:8080/ 

it hungs there forever... :\

SELinux is disabled by default and I didn't re-enable it.

The firewall is configured however I tried to disable it with no better luck.

Nginx works correctly, no issue.

I tried both the Oracle and the OpenJDK JVMs.

Any idea what is causing this?

UPDATE: The output of sudo netstat -atnp|grep LISTEN

$ sudo netstat -atnp|grep LISTEN
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      10634/nginx: master 
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1100/sshd           
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      9645/postgres       
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1503/master         
tcp6       0      0 :::8009                 :::*                    LISTEN      12527/java          
tcp6       0      0 :::8080                 :::*                    LISTEN      12527/java          
tcp6       0      0 :::80                   :::*                    LISTEN      10634/nginx: master 
tcp6       0      0 :::22                   :::*                    LISTEN      1100/sshd           
tcp6       0      0 ::1:5432                :::*                    LISTEN      9645/postgres       
tcp6       0      0 ::1:25                  :::*                    LISTEN      1503/master

UPDATE 2: I noticed that Tomcat eventually becomes active but it takes minutes. Such behavior is not normal for a "vanilla" instance.

Giordano
  • 309
  • 1
  • 3
  • 9
  • pls show the output of `sudo netstat -atnp|grep LISTEN` – Federico Sierra May 19 '16 at 15:38
  • @FedericoSierra I added the information. While collecting it I made a test on the tomcat and noticed that wget was working... It seems that eventually it manages to get up, but it takes an insane amount of time (I updated the question's title) – Giordano May 19 '16 at 15:52
  • Please check tomcat logs `catalina.out` – Federico Sierra May 19 '16 at 15:57
  • 1
    And take a look http://serverfault.com/questions/655616/tomcat7-hangs-on-deploying-apps/655638 – Federico Sierra May 19 '16 at 16:00
  • @FedericoSierra that was it in fact! I solved by using a non blocking entropy source. You saved me a ton of time, thank you *so much* :) If you add the answer I can accept it. – Giordano May 19 '16 at 16:04

1 Answers1

1

The problem is Tomcat waiting for entropy to build up.

Try add the following system property:

-Djava.security.egd=file:/dev/./urandom

See: Tomcat7 hangs on deploying apps

Federico Sierra
  • 3,589
  • 1
  • 20
  • 26