Issues with Lucee on DigitalOcean /dev/random

Just as documentation and FYI to the community. I ran into a number of
issues getting Lucee to install on DigitalOcean VMs (Specifically, CentOS
7.2 x64) automatically during droplet creation.

The problems I was seeing:

  1. Lucee installer hanging while trying to setup mod_proxy/mod_cfml

  2. Lucee taking a long time to boot, stuck on messages like
    “org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned
    for TLDs yet contained no TLDs…” though I’ve seen it stop elsewhere.

After much head banging, I think the issue is due to the use of /dev/random
which is a blocking system call. On DigitalOcean droplets at least,
/dev/random takes a long time to get seeded, and therefore Lucee can
unexpectedly hang during install or startup. This issue may happen on any
VM which does not generate a lot of entropy naturally, not just
DigitialOcean.

There are multiple workarounds I tried:

*1) Redirecting /dev/random to /dev/urandom: *

This ‘worked’ but it requires a reboot of the server (I could not
successfully apply the rule without a reboot, which I do not want to have
to do).

  1. Telling the JVM to use /dev/urandom by adding the following to
    /opt/lucee/tomcat/bin/setenv.sh:
    " -Djava.security.egd=file:/dev/./urandom"

Full line:
CATALINA_OPTS="-Xms256m -Xmx512m -javaagent:lib/lucee-inst.jar
-Djava.security.egd=file:/dev/./urandom";

Although this only fixed boot times, it did not fix the installer hang.

3) (My Preferred Solution) Install HAVEGED

I installed the haveged library to generate entropy for /dev/random via the
CPU, as documented here:

Specifically, these commands for my installation:

#Install repo
su -c ‘rpm -Uvh
http://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-6.noarch.rpm

#install haveged
yum -y install haveged

#start haveged
service haveged start

#start haveged on boot
chkconfig haveged on

#3 is also exactly what I implemented on Digital Ocean as well, though with
Ubuntu (apt-get install haveged), for the same problems. It’s been working
great.

I would recommend that solution to anyone as well, FWIW.On Tuesday, June 14, 2016 at 12:00:27 PM UTC-7, Rory Laitila wrote:

Just as documentation and FYI to the community. I ran into a number of
issues getting Lucee to install on DigitalOcean VMs (Specifically, CentOS
7.2 x64) automatically during droplet creation.

The problems I was seeing:

  1. Lucee installer hanging while trying to setup mod_proxy/mod_cfml

  2. Lucee taking a long time to boot, stuck on messages like
    “org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned
    for TLDs yet contained no TLDs…” though I’ve seen it stop elsewhere.

After much head banging, I think the issue is due to the use of
/dev/random which is a blocking system call. On DigitalOcean droplets at
least, /dev/random takes a long time to get seeded, and therefore Lucee can
unexpectedly hang during install or startup. This issue may happen on any
VM which does not generate a lot of entropy naturally, not just
DigitialOcean.

There are multiple workarounds I tried:

*1) Redirecting /dev/random to /dev/urandom: *
http://superuser.com/questions/309840/how-can-i-point-dev-random-to-dev-urandom

This ‘worked’ but it requires a reboot of the server (I could not
successfully apply the rule without a reboot, which I do not want to have
to do).

  1. Telling the JVM to use /dev/urandom by adding the following to
    /opt/lucee/tomcat/bin/setenv.sh:

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

Full line:
CATALINA_OPTS="-Xms256m -Xmx512m -javaagent:lib/lucee-inst.jar
-Djava.security.egd=file:/dev/./urandom";

Although this only fixed boot times, it did not fix the installer hang.

3) (My Preferred Solution) Install HAVEGED

I installed the haveged library to generate entropy for /dev/random via
the CPU, as documented here:

https://www.digitalocean.com/community/tutorials/how-to-setup-additional-entropy-for-cloud-servers-using-haveged

Specifically, these commands for my installation:

#Install repo
su -c 'rpm -Uvh
http://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-6.noarch.rpm

#install haveged
yum -y install haveged

#start haveged
service haveged start

#start haveged on boot
chkconfig haveged on