chronicle - 失败后如何恢复写入队列
问题描述
磁盘空间完成后,我得到了 InternalError。添加磁盘空间并不能解决问题。
是否有可能恢复并继续坚持?
可能出错我可以尝试重新创建/关闭吗?
的创建queue queue = SingleChronicleQueueBuilder.binary(basePath)
.build();
在单线程上写入“TradeReactorEventPersister-1”
ExcerptAppender appender = acquireAppender;
if (appender == null) {
appender = queue.acquireAppender();
acquireAppender = appender;
}
appender.writeBytes(BytesStore.wrap(b));
在下一个例外之后:
2019-08-23 08:13:26.963 +0000 ERROR [TradeReactorEventPersister-1] LoggingUncaughtExceptionHandler - Uncaught exception a fault occurred in a recent unsafe memory access operation in compiled Java code in thread TradeReactorEventPersister-1
java.lang.InternalError: a fault occurred in a recent unsafe memory access operation in compiled Java code
at net.openhft.chronicle.wire.AbstractWire.updateHeaderAssertions(AbstractWire.java:546)
at net.openhft.chronicle.wire.AbstractWire.updateHeader(AbstractWire.java:533)
at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.writeBytes(SingleChronicleQueueExcerpts.java:470)
2019-08-23 08:13:26.965 +0000 ERROR [TradeReactorEventPersister-1] LoggingUncaughtExceptionHandler - Uncaught exception a fault occurred in a recent unsafe memory access operation in compiled Java code in thread TradeReactorEventPersister-1
java.lang.InternalError: a fault occurred in a recent unsafe memory access operation in compiled Java code
at net.openhft.chronicle.wire.AbstractWire.updateHeaderAssertions(AbstractWire.java:547)
at net.openhft.chronicle.wire.AbstractWire.updateHeader(AbstractWire.java:533)
at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.writeBytes(SingleChronicleQueueExcerpts.java:470)
2019-08-23 08:13:27.166 +0000 ERROR [TradeReactorEventPersister-1] LoggingUncaughtExceptionHandler - Uncaught exception a fault occurred in a recent unsafe memory access operation in compiled Java code in thread TradeReactorEventPersister-1
java.lang.InternalError: a fault occurred in a recent unsafe memory access operation in compiled Java code
at net.openhft.chronicle.wire.AbstractWire.updateHeader(AbstractWire.java:511)
at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.writeBytes(SingleChronicleQueueExcerpts.java:470)
2019-08-23 08:13:27.167 +0000 ERROR [TradeReactorEventPersister-1] LoggingUncaughtExceptionHandler - Uncaught exception you cant put a header inside a header, check that you have not nested the documents. If you are using Chronicle-Queue please ensure that you have a unique instance of the Appender per thread, in other-words you can not share appenders across threads. in thread TradeReactorEventPersister-1
java.lang.AssertionError: you cant put a header inside a header, check that you have not nested the documents. If you are using Chronicle-Queue please ensure that you have a unique instance of the Appender per thread, in other-words you can not share appenders across threads.
at net.openhft.chronicle.wire.AbstractWire.enterHeader(AbstractWire.java:322)
at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.writeHeader(SingleChronicleQueueExcerpts.java:405)
at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.writeBytes(SingleChronicleQueueExcerpts.java:463)
添加磁盘空间后我无法坚持。每次尝试持久化事件时,我都遇到了最后一个异常:
2019-08-23 08:22:50.746 +0000 ERROR [TradeReactorEventPersister-1] LoggingUncaughtExceptionHandler - Uncaught exception you cant put a header inside a header, check that you have not nested the documents. If you are using Chronicle-Queue please ensure that you have a unique instance of the Appender per thread, in other-words you can not share appenders across threads. in thread TradeReactorEventPersister-1
java.lang.AssertionError: you cant put a header inside a header, check that you have not nested the documents. If you are using Chronicle-Queue please ensure that you have a unique instance of the Appender per thread, in other-words you can not share appenders across threads.
at net.openhft.chronicle.wire.AbstractWire.enterHeader(AbstractWire.java:322)
at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.writeHeader(SingleChronicleQueueExcerpts.java:405)
at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.writeBytes(SingleChronicleQueueExcerpts.java:463)
解决方案
不幸的是,编年史队列工作在相当低的级别,并且在数据损坏后无法自动修复(磁盘空间不可避免地会导致数据损坏)。顺便说一句,为了避免这种情况,如果您的磁盘空间不足,Chronicle Queue 会警告您,您应该看到如下警告消息:
"your disk " + this.fileStore + " is almost full, warning: chronicle-queue may crash if it runs out of space."
PS你不应该真的需要做惰性获取逻辑。您总是可以简单地执行 queue.acquireAppender() - 这是一个廉价的调用,它从 ThreadLocal 池中获取预先存在的 appender,并且不会每次都创建新的 appender。
推荐阅读
- ansible - Ansible 包含 vars 文件
- javascript - RxDb,使用默认索引时无法对字段 XXX 进行排序
- spring-boot - 春季数据休息端点未在aws上公开
- firefox - 同源请求会导致“访问控制允许源不匹配”错误,尽管源当然匹配。注意:具有带“沙盒”的 CSP 策略
- javascript - 尝试为我的 Word Dictionary 机器人修复 [object Object]
- python - 将 dict 对象转换为 pandas 数据框时得到不同的结果
- amazon-web-services - Amazon Quicksight 仪表板分析可以导出为 JSON 吗?
- flutter - 单击 GestureDetector 时如何突出显示颜色
- android - 无法使用新的 Unity Build 更新 Android 应用程序,包似乎已损坏
- ios - iOS - 如何配置 VoIP 呼叫屏幕?可能吗?