fabric8io / ipaas-quickstarts

quickstarts for the fabric8 project
Apache License 2.0
66 stars 86 forks source link

quickstart simple mainclass - Takes a long time to run #860

Open davsclaus opened 8 years ago

davsclaus commented 8 years ago

When you deploy it, and tail the logs, then it hang here found about 1min until jolokia initailizes.

I wonder if it need that random trick or something? Maybe @rhuss has an idea?

davsclaus:~/workspace/fabric8-installer/vagrant/openshift (master)/$ oc logs -f quickstart-java-simple-mainclass-tr7qg
Executing /deployments/bin/run ...
Launching application in folder: /deployments
Running  java  -javaagent:/opt/jolokia/jolokia.jar=config=/opt/jolokia/jolokia.properties,useSslClientAuthentication=true,extraClientCheck=true,protocol=https,caCert=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt,clientPrincipal=cn=system:master-proxy -classpath .:/deployments/lib/quickstart-java-simple-mainclass-2.2.57-SNAPSHOT.jar:/deployments/lib/commons-lang3-3.4.jar io.fabric8.quickstarts.java.simple.Main
davsclaus commented 8 years ago

And when about 1 min or so, it runs

davsclaus:~/workspace/fabric8-installer/vagrant/openshift (master)/$ oc logs -f quickstart-java-simple-mainclass-tr7qg
Executing /deployments/bin/run ...
Launching application in folder: /deployments
Running  java  -javaagent:/opt/jolokia/jolokia.jar=config=/opt/jolokia/jolokia.properties,useSslClientAuthentication=true,extraClientCheck=true,protocol=https,caCert=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt,clientPrincipal=cn=system:master-proxy -classpath .:/deployments/lib/quickstart-java-simple-mainclass-2.2.57-SNAPSHOT.jar:/deployments/lib/commons-lang3-3.4.jar io.fabric8.quickstarts.java.simple.Main
I> No access restrictor found, access to all MBean is allowed
Jolokia: Agent started with URL https://172.17.0.8:8778/jolokia/
Hello Fabric8! Here's your random string: Xz3GT
Hello Fabric8! Here's your random string: LjpkX
Hello Fabric8! Here's your random string: c37zw
Hello Fabric8! Here's your random string: Bu7xX
Hello Fabric8! Here's your random string: ptk3g
Hello Fabric8! Here's your random string: XJb50
Hello Fabric8! Here's your random string: LiBiD
Hello Fabric8! Here's your random string: wSokC
rhuss commented 8 years ago

Could be because jolokia is configured to use SSL now and it creates a self-signed TLS certificate during startup. If there is not enough entropy in the system, it block on /dev/random (same issue as with Tomcat).

A solution is to use -Djava.security.egd=file:/dev/./urandom. Can you try with adding a <JAVA_OPTIONS>-Djava.security.egd=file:/dev/./urandom"</JAVA_OPTIONS> to the <env> section in the d-m-p configuration ?

davsclaus commented 8 years ago

Trying now

davsclaus:~/workspace/fabric8-installer/vagrant/openshift (master)/$ oc logs -f quickstart-java-simple-mainclass-i9h5c
Executing /deployments/bin/run ...
Launching application in folder: /deployments
Running  java  -Djava.security.egd=file:/dev/./urandom" -javaagent:/opt/jolokia/jolokia.jar=config=/opt/jolokia/jolokia.properties,useSslClientAuthentication=true,extraClientCheck=true,protocol=https,caCert=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt,clientPrincipal=cn=system:master-proxy -classpath .:/deployments/lib/quickstart-java-simple-mainclass-2.2.57-SNAPSHOT.jar:/deployments/lib/commons-lang3-3.4.jar io.fabric8.quickstarts.java.simple.Main

But still takes 30-60 seconds before printing the hello fabric8

rhuss commented 8 years ago

Strange, for me it starts immediately (even without the providing the urandom thing).

davsclaus commented 8 years ago

Its slow today again with a new vagrant as I destroyed the old one. It takes about 30 sec or so.

Though we should check some of others as it would cause a scale up use-case or redeploy etc to be slow if the java app takes 30 sec to boot.

davsclaus commented 8 years ago

The cdi quickstarts started quickly and the scale up/down demo of the http/jetty works well.

davsclaus commented 8 years ago

Removing this makes it run fast

  <fabric8.env.AB_JOLOKIA_AUTH_OPENSHIFT>true</fabric8.env.AB_JOLOKIA_AUTH_OPENSHIFT>