Java SecureRandom slowdown
Today, I had to and update to a Linode server that we have with an updated war file. I had already deployed this war file on other Linode servers so I didn’t think much of it. I removed the old war file and deployed the new one and restarted the server but would not start.
I tried restarting the service a couple of times and also performed yum update
as well. I restared the server too.
However, I was not able to run the war application. I double checked it a couple of times and everything seemed ok.
I decided to rollback the update but still could not get tomcat to run the application.
Finally, I removed my app completely and started tomcat. It would not run.
Frustrated, I called my buddy and went online on search of an answer.
I came upon this post.
I went and found java.security
file and replaced securerandom.source=file:/dev/random
to file:/dev/./urandom
.
Then I restarted the server and boom, it worked. What threw me off was that I had done no apparent updates to the server and only restarting the tomcat server caused this problem.
So folks, remember if you have a java app on a VM, make sure you check the securerandom setting.
Still weird that something that’s supposed to be so stable can get bogged down like this.