In my web application, login passwords are hashed and saved with JasyptStringDigester with SHA256. During login, password input by user will be hashed with same digester for comparsion.
However, after the application runs about 2 days, login becomes very slow suddenly. Once it happens, I have to restart the server to recover.
With Thread dump, I found out that the slowdown is caused by the digester and it uses up CPU resources. I have tried to change JCE provider from default one to bouncycastle but it didn't help.
I have also checked the momery usage in JVM when this problem occurs, but there are plenty of them.
Environment:
JDK 7u60
JBoss 7.1.1 Final
Digester configuration(used as singleton):
<bean id="jasyptStringDigester" class="org.jasypt.digest.StandardStringDigester">
<property name="provider" ref="bouncyCastleProvider" />
<property name="algorithm" value="SHA-256" />
<property name="iterations" value="100000" />
<property name="saltGenerator">
<bean id="zeroSaltGenerator" class="org.jasypt.salt.ZeroSaltGenerator"/>
</property>
<property name="saltSizeBytes" value="10"/>
</bean>
<bean id="bouncyCastleProvider" class="org.bouncycastle.jce.provider.BouncyCastleProvider"/>
Thread dump:
"ajp--10.88.90.34-8009-22" daemon prio=10 tid=0x00007ff2100ad800 nid=0xc7e runnable [0x00007ff1a9ae4000]
java.lang.Thread.State: RUNNABLE
at org.bouncycastle.crypto.digests.SHA256Digest.Sum0(Unknown Source)
at org.bouncycastle.crypto.digests.SHA256Digest.processBlock(Unknown Source)
at org.bouncycastle.crypto.digests.GeneralDigest.finish(Unknown Source)
at org.bouncycastle.crypto.digests.SHA256Digest.doFinal(Unknown Source)
at org.bouncycastle.jcajce.provider.digest.BCMessageDigest.engineDigest(Unknown Source)
at java.security.MessageDigest.digest(MessageDigest.java:353)
at java.security.MessageDigest.digest(MessageDigest.java:399)
at org.jasypt.digest.StandardByteDigester.digest(StandardByteDigester.java:979)
- locked <0x0000000748e4a9c0> (a org.bouncycastle.jcajce.provider.digest.SHA256$Digest)
at org.jasypt.digest.StandardByteDigester.digest(StandardByteDigester.java:933)
Would anyone help please? I have been stuck into this problem for a long time. A similar issue was found in https://bugs.openjdk.java.net/browse/JDK-8023983 but I couldn't find any solution.
Thanks.