When Kryo is used in a multi-threaded environment external synchronization is
required to ensure that the internally used HashMap classToRegisteredClass (and
probably the IntHashMap idToRegisteredClass) cannot be broken which might cause
infinite loops.
The suggested patch now synchronizes write access of classToRegisteredClass on
exactly this object. From my understanding this is enough to ensure that the
HashMap internal linked lists cannot be broken. As read access is not
synchronized it might happen that some thread gets an "invalid" object from the
map that is replaced by a second thread, but IMHO this isn't an issue as
correct functionality/behavior is not affected by this.
As the synchronized block on classToRegisteredClass also included the
idToRegisteredClass.put, I think this potential concurrency issue is also
solved.
Is this patch acceptable? Can you apply it as soon as possible and make a new
release? This would save the world for me right now :-)
Original issue reported on code.google.com by martin.grotzke on 8 Sep 2010 at 1:05
Original issue reported on code.google.com by
martin.grotzke
on 8 Sep 2010 at 1:05Attachments: