java.lang.Thread.State: BLOCKED (on object monitor) at java.security.SecureRandom.nextBytes(SecureRandom.java:468) - waiting to lock <0x0000000744cb6070> (a java.security.SecureRandom) at org.bouncycastle.crypto.CipherKeyGenerator.generateKey(Unknown Source) at org.bouncycastle.jcajce.provider.symmetric.util.BaseKeyGenerator.engineGenerateKey(Unknown Source) at javax.crypto.KeyGenerator.generateKey(KeyGenerator.java:540)
This is a known issue [1] in Linux systems where the /dev/random runs out of "entropy" and it causes the system to block threads.
[1] https://bugs.java.com/view_bug.do?bug_id=6708214
-
The easiest solution is to install haveged to the Linux OS. This process makes sure that the /dev/random device is supplied with enough randomness to avoid performance issues.
On Debian based platforms (Debian, Ubuntu):
sudo apt-get install rng-tools sudo update-rc.d haveged defaults
sudo yum install rng-tools sudo chkconfig haveged on
-
Alternative solutions can be found here.