On Tue, Oct 30, 2012 at 3:56 AM, Christoph Engelbert <[email protected]>wrote:
> Hey guys, > > while having a look how to implement the Lightning Serializer > adapter I recognized that maybe the current implementation of the > KryoSerializer and maybe some more could be absolutely thread unsafe. > > private final byte[] buffer = new byte[ BUFFER_SIZE ]; > private final Output output = new Output( buffer, -1 ); > private final Input input = new Input( buffer ); > > Only one byte[] buffer is used for serialization and > deserialization. Is somewhere deep in DM an instantiater hidden that > generates new instances of the serializer or will there be a problem > if different threads read / write at the same time? > Good catch. Its definitely not thread safe. Other serializers(including kryo) on jvm-serializers benchmark (referenced by tatu in this thread), are not thread-safe either. > Cheers Chris > -- When the cat is away, the mouse is alone. - David Yu
