Large messages causing crash in different ways
See original GitHub issueIn the documentation there is no mention of message size limitation. Here is a sample code which cause a break on Linux:
import net.openhft.chronicle.core.UnsafeMemory;
import net.openhft.chronicle.queue.ChronicleQueue;
import net.openhft.chronicle.queue.ChronicleQueueBuilder;
import net.openhft.chronicle.queue.ExcerptAppender;
import sun.misc.Unsafe;
public class CQAppenderTest {
static final int ITER = 2;
static final int SIZE = 50 * 1000 * 1000;
public static void main(String[] args) {
ChronicleQueue queue = ChronicleQueueBuilder.single("queueDir").build();
final ExcerptAppender appender = queue.acquireAppender();
byte[] array = new byte[SIZE];
long startTime = System.currentTimeMillis();
for (int i = 0; i < ITER; i++) {
appender.writeBytes(b -> {
long address = b.addressForRead(b.writePosition());
Unsafe unsafe = UnsafeMemory.UNSAFE;
unsafe.copyMemory(array, Unsafe.ARRAY_BYTE_BASE_OFFSET, null, address, array.length);
b.writeSkip(array.length);
});
}
long estimatedTime = System.currentTimeMillis() - startTime;
System.out.println("time = " + estimatedTime);
}
}
And here is the error message:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007fddf138f172, pid=25577, tid=0x00007fddf2791700
#
# JRE version: Java(TM) SE Runtime Environment (8.0_161-b12) (build 1.8.0_161-b12)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.161-b12 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V [libjvm.so+0x803172]
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# ~/smallTests/CQTest/hs_err_pid25577.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
#
Also, I have tried to write message with appender.writeDocument. Although it works with 50MB message, it fails with 100MB message size:
Exception in thread "main" java.lang.IllegalArgumentException: pos: 100131612, store.writePosition()=131584 queue.blockSize()=67108864
at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.position(SingleChronicleQueueExcerpts.java:495)
at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.access$2000(SingleChronicleQueueExcerpts.java:66)
at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender$HeaderWriteStrategyOriginal.onContextOpen(SingleChronicleQueueExcerpts.java:841)
at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.writingDocument(SingleChronicleQueueExcerpts.java:332)
at net.openhft.chronicle.wire.MarshallableOut.writeDocument(MarshallableOut.java:95)
at CQAppenderTest.main(CQAppenderTest.java:22)
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
9 Best Fixes for Android Messages Keeps Crashing Issue
2. Delete Old Messages. The Messages app crashing issue mostly happens because either one of your message threads is too long or you...
Read more >How to fix Messages app keeps crashing and freezing on ...
Messages app keeps crashing on iPhone? try these fixes, 1. Force quit Messages app, 2. Restart iPhone, 3. Delete Messages automatically...
Read more >How to Fix Your Phone When it Crashes from a Text Message ...
The easiest way is usually to open the app on another platform — your computer probably won't be affected by the bug —...
Read more >There's a emoji message that freezes or completely crashes ...
You may have already come across it and wondered how just tapping on a single emoji can cause an app to freeze and...
Read more >Reading a large file into an array causes a crash
I have no information on why it crashes and no error message is given (except the generic "a problem caused this program to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

A related issue is https://github.com/OpenHFT/Chronicle-Bytes/issues/66 as write(bytes) and read(bytes) can also fail in some cases.
hence, you could increase your block size see net.openhft.chronicle.queue.ChronicleQueueBuilder#blockSize(int) , [ but you should make sure that your largest message size is no larger than 1/4 of your block size]