Skip to content

MessageDigestCacheKeyGenerator not thread safe on IBM JVMs #103

@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?

1. Set JAVA_HOME to point to an IBM JVM (available from 
http://www.ibm.com/developerworks/java/jdk/ , on Windows the JVM is included in 
the 'IBM Development Package for Eclipse' zip file)

2. Build attached maven project (mvn clean compile)

3. Run attached maven project (mvn exec:java)

What is the expected output? 

No errors

What do you see instead?

Using IBM JVMs I see

ERROR 10:54:24.655 - Key error: value = "MH4", expected key 
"92DPOWUQFqlVzPkQ3RMGJl46KX8", recalculated key = "zuXeU-hhBz_-WBiJz7EM3GtVXj4"
ERROR 10:54:24.757 - Key error: value = "H9Z", expected key 
"YCoaWhfJb3NsPzmWm9d4gm97Y6c", recalculated key = "PEFfODlrxV1TZwW1NIy92eDmrek"
ERROR 10:54:25.549 - Key error: value = "UTF", expected key 
"4j9eB7FELr3evE0bcnS9tt9Kt_Y", recalculated key = "qA4bDSEObtDM3-qi_Fj7CftqSl0"
ERROR 10:54:25.586 - Key error: value = "PUK", expected key 
"CxriFViz3z_2AT8dfeKnjjskN0k", recalculated key = "YCoaWhfJb3NsPzmWm9d4gm97Y6c"
ERROR 10:54:26.432 - Key error: value = "A2U", expected key 
"mTKCmIe2hqh73OquZYCbm5e3ayQ", recalculated key = "2XE4gv9phvMEJYLYYZyIbWFp9u0"
...
...

What version of the product are you using? On what operating system?

Version 1.2.0 on Windows and Linux

Please provide any additional information below.

A customer is having problems with the wrong cached data being returned in 
their application.  They are using Ehcache Spring Annotations and I have found 
that under load the wrong key is occassionally returned from the 
MessageDigestCacheKeyGenerator.generateKey method.

The problem seems only to occur on IBM JVMs (as used by WebSphere).  I have 
seen the problem on IBM 1.6 and 1.7 JVMs on Windows (32 and 64 bit) and on IBM 
1.6 JVMs on Linux (not tested with 1.7).

I have attached some simple test code which demonstrates the problem.  Some, 
but not all, of the incorrectly generated keys are the keys of other data used 
in the test.

Original issue reported on code.google.com by allanct...@gmail.com on 22 Aug 2013 at 10:23

Attachments:

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions