1

Here is the stack trace :

java.lang.ArrayStoreException
        at java.util.HashMap.transfer(Unknown Source)
        at java.util.HashMap.resize(Unknown Source)
        at java.util.HashMap.addEntry(Unknown Source)
        at java.util.HashMap.put(Unknown Source)
        at java.util.HashSet.add(Unknown Source)

Some observations :

  1. Its an intermittent issue
  2. JDK 1.6
  3. CentOS 5.3

As I understand this error is intermittent I suspect it occurs whenever the HashSet (hence underlying HashMap) needs to resize itself. But not sure why this ArrayStoreException. Now what I want to know is

-What are the scenarios wherein this error can occur ?

9
  • Have you tried to debug? You can attach jdk sources to your IDE and look at the exact line, where error occurs. Commented Sep 27, 2011 at 6:44
  • @Nikita, as mentioned, this error is intermittent, we could not reproduce it consistently hence debugging didn't help. Commented Sep 27, 2011 at 6:54
  • There is no way this can happen, must be a bug somewhere. Even hardware bugs. Commented Sep 27, 2011 at 6:55
  • What kind of JDK is this? OpenJDK? Commented Sep 27, 2011 at 6:58
  • @ThomasJungblut, its the JDK from SUN/Oracle Commented Sep 27, 2011 at 7:03

1 Answer 1

1

My guess is that you're trying to update the set from multiple threads concurrently. HashSet and HashMap aren't designed to be thread-safe - if you're going to access your set from multiple threads, you should use synchronization to prevent concurrent access.

That's just a guess, of course - without seeing your code I can't tell whether you are using multiple threads. It would go along with the intermittent side of things though...

Sign up to request clarification or add additional context in comments.

5 Comments

the code does not run in a multi-threaded environment. We are seeing this when extremely large amount of data is loaded in the HashsSet.
@Santosh: Okay, in that case it sounds like a bug in the JRE. If you can log the order in which you add things to the set, you may be able to reproduce it - at which point life would be a lot easier.
we have added to code the catch this exception and the object causing it. So far it hasn't shown in the logs. I will update the the question with more information we get when the error shows up in logs.
@Santosh: I would try to write an application which just tried to provoke this bug. Generate random objects and log them before adding, repeating with different random seeds until you find one which provokes the bug. I doubt that it's anything special about the single object - it'll be in some odd state beforehand.
thanks for the pointer, we are trying this approach to reproduce this issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.