Waiting for the other shoe to drop

So have you ever tried to get Oracle Service Bus 10gR3, Oracle WebLogic Server 9.2.2 or 10gR3 to start up fast on a Linux (Oracle Enterprise Linux, Red Hat Linux or any other variant)? Takes a bit of time, hmm? Well, there is a reason for it and it is because of this (Bug ID: 6202721)not-a-bug bug in the JVM.

Essentially getting a random number from the system is done by querying the /dev/random or /dev/urandom device on the system. On a Windows box these “devices” default always to the CryptoAPI and that works fine. On Linux the /dev/random seeds the random numbers with an entropy pool which is all well and good. But say you are a server, especially a server that has not started the “services” yet – like an application server – you will not generate enough entropy to fill your pools for quite a while. This is because it is the network and disk I/O operations that make the entropy, and obviously you are not yet at the point where you will create any of that. So then the “really random randomness” of /dev/random becomes a hinderance rather than a benefit, because the startup times are a pain.

So this is where /dev/urandom steps in with its non-blocking and “less random randomness” (but still good enough randomness for most uses) goodness. Except for the “non-bug” of course. So there are many work-arounds to it, but I personally prefer changing the securerandom.source entry in the $JAVA_HOME/jre/lib/security/java.security file to securerandom.source=file:/dev/./urandom. Now everything starts up like a dream, as it should.

Leave a Reply

Your email address will not be published. Required fields are marked *