Below is a simple fix that the test intermittently fails on.

The problem is believed to be that the read thread sees a close_notify which cause the read thread to do a write operation. That write operation conflicts with the on-going write thread usage of the Cipher object doing the encryption. Synchronizing the methods fixes the conflict and performance should not be affected as encrypt operations should always be single-threaded. Other solutions, like creating cipher objects or a cipher object pool would be a bigger performance hit in this limited failure situation.

Because the test is intermittent, I've never been able to reproduce it. Given different exceptions related to cipher initialization have occured in the encrypt method, I believe this will resolve the problem.

http://cr.openjdk.java.net/~ascarpino/8206968/webrev/

Tony

Reply via email to