When a DB is opened with fileMmapEnabled and cleanerHackEnabled in readonly mode, closing the database does not clean the buffer.
The following message is logged:
Apr 25, 2023 11:34:16 AM org.mapdb.volume.ByteBufferVol unmap
WARNING: Failed to free the buffer. java.io.IOException: java.lang.IllegalArgumentException: duplicate or slice
This is caused by the fact that buffer in MappedFileVolSingle is set to a duplicate of the original buffer when it is readonly. The close tries to unmap the duplicate of the buffer, not the original buffer.
When a DB is opened with fileMmapEnabled and cleanerHackEnabled in readonly mode, closing the database does not clean the buffer. The following message is logged: Apr 25, 2023 11:34:16 AM org.mapdb.volume.ByteBufferVol unmap WARNING: Failed to free the buffer. java.io.IOException: java.lang.IllegalArgumentException: duplicate or slice
This is caused by the fact that buffer in MappedFileVolSingle is set to a duplicate of the original buffer when it is readonly. The close tries to unmap the duplicate of the buffer, not the original buffer.
This occurs in version 3.0.9.