Chronicle-Bytes icon indicating copy to clipboard operation
Chronicle-Bytes copied to clipboard

Boundary underflow in chunked mapped file in multiple operations near chunk boundary

Open alamar opened this issue 2 years ago • 3 comments

Exception in thread "main" net.openhft.chronicle.bytes.util.DecoratedBufferUnderflowException: Acquired the next BytesStore, but still not room to add 2 when realCapacity 15728640
	at net.openhft.chronicle.bytes.internal.ChunkedMappedBytes.writeCheckOffset(ChunkedMappedBytes.java:266)
	at net.openhft.chronicle.bytes.AbstractBytes.writeOffsetPositionMoved(AbstractBytes.java:1023)
	at net.openhft.chronicle.bytes.AbstractBytes.writeOffsetPositionMoved(AbstractBytes.java:1016)
	at net.openhft.chronicle.bytes.AbstractBytes.writeShort(AbstractBytes.java:1043)
	at org.example.Main.main(Main.java:38)

alamar avatar Oct 06 '22 16:10 alamar

Broken by commit

commit e6598e3723e04248670da493761326b36c45617a (HEAD)
Author: Jerry Shea <[email protected]>
Date:   Wed Aug 3 11:01:41 2022 +1000

    undo <= change from previous commit and add test. Add MappedBytesEdgeTest and address off-by-ones. Closes #412. Fix ChunkedMappedBytes.ensureCapacity. Make acquireNextByteStore0 use 3 args. Closes #417. Clean up use of API

@JerryShea can you please take a look?

alamar avatar Oct 06 '22 17:10 alamar

https://github.com/OpenHFT/Chronicle-Bytes/pull/455 a test for this issue

alamar avatar Oct 06 '22 17:10 alamar

acquireNextByteStore0() in ChunkedMappedBytes:272 now fails to pullback to previous chunk when we need to write message starting in it.

alamar avatar Oct 06 '22 17:10 alamar

See #452

alamar avatar Oct 18 '22 16:10 alamar

Supposedly fixed in develop by b305af85c6f3fe0ebe60df7c58b9477f5b04ae7c

alamar avatar Oct 27 '22 16:10 alamar