com.hazelcast.nio.serialization.HazelcastSerializationException: java.util.ConcurrentModificationException

318 views
Skip to first unread message

al...@betgenius.com

unread,
Jan 9, 2014, 9:18:09 AM1/9/14
to haze...@googlegroups.com
Greetings,

We’re getting errors in our logs like this:

com.hazelcast.nio.serialization.HazelcastSerializationException: java.util.ConcurrentModificationException
        at com.hazelcast.nio.serialization.SerializationServiceImpl.handleException(SerializationServiceImpl.java:295) ~[hazelcast-all-3.1.1.jar:3.1.1]
        at com.hazelcast.nio.serialization.SerializationServiceImpl.toData(SerializationServiceImpl.java:194) ~[hazelcast-all-3.1.1.jar:3.1.1]
        at com.hazelcast.nio.serialization.SerializationServiceImpl.toData(SerializationServiceImpl.java:157) ~[hazelcast-all-3.1.1.jar:3.1.1]
        at com.hazelcast.map.MapService.toData(MapService.java:659) ~[hazelcast-all-3.1.1.jar:3.1.1]
        at com.hazelcast.map.proxy.MapProxyImpl.put(MapProxyImpl.java:72) ~[hazelcast-all-3.1.1.jar:3.1.1]
        at com.hazelcast.map.proxy.MapProxyImpl.put(MapProxyImpl.java:60) ~[hazelcast-all-3.1.1.jar:3.1.1]
        at <the line of our code that puts an entry into an IMap object>
        at java.lang.Thread.run(Thread.java:724) ~[na:1.7.0_25]
Caused by: java.util.ConcurrentModificationException: null
        at java.util.HashMap$HashIterator.nextEntry(HashMap.java:894) ~[na:1.7.0_25]
        at java.util.HashMap$KeyIterator.next(HashMap.java:928) ~[na:1.7.0_25]
        at java.util.HashSet.writeObject(HashSet.java:283) ~[na:1.7.0_25]
        at sun.reflect.GeneratedMethodAccessor381.invoke(Unknown Source) ~[na:na]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_25]
        at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_25]
        at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:986) ~[na:1.7.0_25]
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493) ~[na:1.7.0_25]
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1429) ~[na:1.7.0_25]
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175) ~[na:1.7.0_25]
        at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1541) ~[na:1.7.0_25]
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1506) ~[na:1.7.0_25]
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1429) ~[na:1.7.0_25]
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175) ~[na:1.7.0_25]
        at java.io.ObjectOutputStream.writeUnshared(ObjectOutputStream.java:414) ~[na:1.7.0_25]
        at com.hazelcast.nio.serialization.DefaultSerializers$ObjectSerializer.write(DefaultSerializers.java:206) ~[hazelcast-all-3.1.1.jar:3.1.1]
        at com.hazelcast.nio.serialization.StreamSerializerAdapter.write(StreamSerializerAdapter.java:48) ~[hazelcast-all-3.1.1.jar:3.1.1]
        at com.hazelcast.nio.serialization.SerializationServiceImpl.toData(SerializationServiceImpl.java:176) ~[hazelcast-all-3.1.1.jar:3.1.1]
        ... 26 common frames omitted


Does anyone have any idea what could be causing this exception?

Thanks,

Alex

ali gurbuz

unread,
Jan 9, 2014, 9:50:21 AM1/9/14
to haze...@googlegroups.com
Could you please post your key/value classes


--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+...@googlegroups.com.
To post to this group, send email to haze...@googlegroups.com.
Visit this group at http://groups.google.com/group/hazelcast.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/7adb1ee0-3948-4323-a215-740f4827bb70%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

ali gurbuz

unread,
Jan 10, 2014, 3:20:22 AM1/10/14
to haze...@googlegroups.com
Here the problem is while hazelcast serializing HashSet you have provided, some other thread modifies it.
So you get a ConcurrentModificationException

al...@betgenius.com

unread,
Jan 10, 2014, 4:35:45 AM1/10/14
to haze...@googlegroups.com
On Friday, January 10, 2014 8:20:22 AM UTC, Gurbuz wrote:
Here the problem is while hazelcast serializing HashSet you have provided, some other thread modifies it.
So you get a ConcurrentModificationException

Thanks; that’s now what we’re thinking too.

It turns out that the value we’re putting into the IMap is sometimes a type that wraps another type that extends HashSet (without adding any thread-safety guarantees).

Thanks again,

Alex
Reply all
Reply to author
Forward
0 new messages