Web-based based bug tracker
Bugzero bug tracker
Q: Why the SecureRandom generateSeed is so slow or even hang on Linux OS?

A: When you login, it hangs or takes more than a minute to get the response.
   If your server is on a Linux OS, the culprit here is SecureRandom generateSeed()
   which uses /dev/random to generate the seed. However, /dev/random is a blocking 
   number generator and if it doesn't have enough random data to provide, it will 
   simply wait until it does, which forces the JVM to wait. Keyboard and mouse input
   as well as disk activity can generate the randomness or entropy needed. But on a
   server that lacks such activies, the problem may arise.
   To verify this, run command:

   cat /proc/sys/kernel/random/entropy_avail
   it could be 150 or less, instead of the normal 3000-4000.

   There are two options to workaround this problem:

   1) Use jvm param:  -Djava.security.egd=file:/dev/./urandom

   or even better

   2) run daemon: /sbin/rngd -r /dev/urandom -o /dev/random -t 5
   you can add this in rc.local or you can use
   /etc/init.d/rngd, but make sure /etc/sysconfig/rngd has
   EXTRAOPTIONS="-r /dev/urandom -o /dev/random -t 5"

   Or, if you are on systemd, then you might already have rngd.service,
   just enable and start it.
   run ps -aux|grep rngd to see it is running.

* Reference brought to you by Bugzero, it's more than just bug tracking software!

Home - FAQs