When I try to use Chronicle Map I have a number of errors which I haven't been able to work out. In my latest attempt to debug, I read the stream into memory to check what the bytes were but it crashes the whole JVM.
EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000005079c1b0, pid=7128, tid=10476
I'm using Kryo to write my data and read it back in using a BytesMarshaller<T>
for each type like this:
public void write(Bytes bytes, T obj)
{
ByteArrayOutputStream baos = null;
try (ByteArrayOutputStream baos2 = new ByteArrayOutputStream())
{
try (Output output = new Output(baos2))
{
kryos.get().writeObject(output, obj);
baos = baos2;
}
}
byte[] byteArray = baos.toByteArray();
OutputStream out = bytes.outputStream();
{
out.write(byteArray);
}
}
to write and this to read:
public T read(Bytes bytes)
{
ByteArrayOutputStream baos = null;
try (ByteArrayOutputStream baos2 = new ByteArrayOutputStream())
{
InputStream in = bytes.inputStream();
{
ByteStreams.copy(in, baos2);
baos = baos2;
}
}
try (Input input = new Input(baos.toByteArray()))
{
return kryos.get().readObject(input, cls);
}
}
I've tried closing the streams but get exactly the same problem.
This problem happens when I'm starting to iterate over a key set - not sure if that's relevant.
This is my stack trace:
j com.google.common.io.ByteStreams.copy(Ljava/io/InputStream;Ljava/io/OutputStream;)J+28
j uk.org.jaggard.dao.memory.KryoBytesMarchaller.read(Lnet/openhft/lang/io/Bytes;)Ljava/lang/Object;+28
j net.openhft.chronicle.hash.serialization.internal.BytesReaders$SimpleBytesReader.read(Lnet/openhft/lang/io/Bytes;J)Ljava/lang/Object;+5
j net.openhft.chronicle.map.VanillaChronicleMap$Segment.getEntry(Lnet/openhft/chronicle/map/VanillaChronicleMap$SegmentState;J)Ljava/util/Map$Entry;+70
j net.openhft.chronicle.map.VanillaChronicleMap$EntryIterator.next()Ljava/util/Map$Entry;+115
j net.openhft.chronicle.map.VanillaChronicleMap$EntryIterator.next()Ljava/lang/Object;+1
j java.util.AbstractMap$1$1.next()Ljava/lang/Object;+4