java.lang.ArrayIndexOutOfBoundsException in TIntIntHashMap.keys

Issue #54 invalid
Stefan Berndt created an issue

At first many thanks for this great lib. It does its job very well over long time.

But at very rare times it creates this error: Exception in thread "GeneralSTPool-31" java.lang.ArrayIndexOutOfBoundsException: 1 at gnu.trove.map.hash.TIntIntHashMap.keys(TIntIntHashMap.java:305) at com.l2dcproject.gameserver.model.zone.type.L2EffectZone$ApplySkill.run(L2EffectZone.java:325)

Relevant code: TIntIntHashMap _skills; ... for (int skillId : _skills.keys()) ...

Same map created more error messages: Exception in thread "GeneralSTPool-38" java.lang.ArrayIndexOutOfBoundsException: -4 at gnu.trove.map.hash.TIntIntHashMap.rehash(TIntIntHashMap.java:189) at gnu.trove.impl.hash.THash.postInsertHook(THash.java:388) at gnu.trove.map.hash.TIntIntHashMap.doPut(TIntIntHashMap.java:222) at gnu.trove.map.hash.TIntIntHashMap.put(TIntIntHashMap.java:198) at com.l2dcproject.gameserver.model.zone.type.L2EffectZone.addSkill(L2EffectZone.java:257)

relevant code: _skills.put(skillId, skillLvL);

After a while some other maps are affected too, and only the restart of the whole application fixes this.

This is'nt the first time such kind of error happens, but its very rare. It happends maybe 2 times a year. We are using TIntIntHashMap very heavy.

Version is 3.0.3, OS is FreeBSD 9.2 AMD64, Java is OpenJDK7

Comments (5)

  1. Rob Eden

    Thanks for the kind words. :-)

    I've never heard of this happening without being a threading issue. If you think otherwise, we'll need some more debugging info and possibly a test case.

    I see from your trace that it's being hit from a thread pool. What does your synchronization strategy for the map look like?

  2. Stefan Berndt reporter

    I lower my head in shame. After you ask "What does your synchronization strategy..." i take a deeper look into the source and i must confess: there is none for this object.

    Thanks for your comment and sorry for wasted time. (this issue can be set to solved)

  3. Rob Eden

    No worries at all. It's easy to do.

    Thanks for using Trove and taking the time to figure out the issue.

  4. Log in to comment