使用 Artemis 2.17.0 和 openjdk-1.8.0.302 获取 "Failure when accessing a lock file: java.io.IOException"

Getting "Failure when accessing a lock file: java.io.IOException" with Artemis 2.17.0 and openjdk-1.8.0.302

2022-03-01 01:28:16,860 WARN  [org.apache.activemq.artemis.core.server.impl.FileLockNodeManager] Failure when accessing a lock file: java.io.IOException: The system cannot find the file specified
    at sun.nio.ch.FileDispatcherImpl.lock0(Native Method) [rt.jar:1.8.0_302]
    at sun.nio.ch.FileDispatcherImpl.lock(FileDispatcherImpl.java:107) [rt.jar:1.8.0_302]
    at sun.nio.ch.FileChannelImpl.tryLock(FileChannelImpl.java:1114) [rt.jar:1.8.0_302]
    at java.nio.channels.FileChannel.tryLock(FileChannel.java:1155) [rt.jar:1.8.0_302]
    at org.apache.activemq.artemis.core.server.impl.FileLockNodeManager.tryLock(FileLockNodeManager.java:389) [artemis-server-2.17.0.jar:2.17.0]
    at org.apache.activemq.artemis.core.server.impl.FileLockNodeManager.lock(FileLockNodeManager.java:408) [artemis-server-2.17.0.jar:2.17.0]
    at org.apache.activemq.artemis.core.server.impl.FileLockNodeManager.getState(FileLockNodeManager.java:349) [artemis-server-2.17.0.jar:2.17.0]
    at org.apache.activemq.artemis.core.server.impl.FileLockNodeManager.access0(FileLockNodeManager.java:36) [artemis-server-2.17.0.jar:2.17.0]
    at org.apache.activemq.artemis.core.server.impl.FileLockNodeManager$MonitorLock.run(FileLockNodeManager.java:516) [artemis-server-2.17.0.jar:2.17.0]
    at org.apache.activemq.artemis.core.server.ActiveMQScheduledComponent.runForExecutor(ActiveMQScheduledComponent.java:313) [artemis-commons-2.17.0.jar:2.17.0]
    at org.apache.activemq.artemis.core.server.ActiveMQScheduledComponent.bookedRunForScheduler(ActiveMQScheduledComponent.java:328) [artemis-commons-2.17.0.jar:2.17.0]
    at org.apache.activemq.artemis.core.server.ActiveMQScheduledComponent.runForScheduler(ActiveMQScheduledComponent.java:339) [artemis-commons-2.17.0.jar:2.17.0]
    at org.apache.activemq.artemis.core.server.ActiveMQScheduledComponent.lambda$start[=11=](ActiveMQScheduledComponent.java:166) [artemis-commons-2.17.0.jar:2.17.0]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [rt.jar:1.8.0_302]
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [rt.jar:1.8.0_302]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access1(ScheduledThreadPoolExecutor.java:180) [rt.jar:1.8.0_302]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [rt.jar:1.8.0_302]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [rt.jar:1.8.0_302]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [rt.jar:1.8.0_302]
    at org.apache.activemq.artemis.utils.ActiveMQThreadFactory.run(ActiveMQThreadFactory.java:118) [artemis-commons-2.17.0.jar:2.17.0]

出现上述错误后,artemis 服务器正在关闭 java.io.IOException: An unexpected network error occurred:

2022-03-01 02:00:10,690 WARN  [org.apache.activemq.artemis.core.server] AMQ222010: Critical IO Error, shutting down the server. file=NIOSequentialFile \shared-path\activemq-bindings-2.bindings, message=An unexpected network error occurred: ActiveMQIOErrorException[errorType=IO_ERROR message=An unexpected network error occurred]
    at org.apache.activemq.artemis.core.io.nio.NIOSequentialFile.internalWrite(NIOSequentialFile.java:410) [artemis-journal-2.17.0.jar:2.17.0]
    at org.apache.activemq.artemis.core.io.nio.NIOSequentialFile.writeDirect(NIOSequentialFile.java:374) [artemis-journal-2.17.0.jar:2.17.0]
    at org.apache.activemq.artemis.core.io.AbstractSequentialFile.write(AbstractSequentialFile.java:239) [artemis-journal-2.17.0.jar:2.17.0]
    at org.apache.activemq.artemis.core.io.AbstractSequentialFile.write(AbstractSequentialFile.java:252) [artemis-journal-2.17.0.jar:2.17.0]
    at org.apache.activemq.artemis.core.journal.impl.JournalImpl.appendRecord(JournalImpl.java:2939) [artemis-journal-2.17.0.jar:2.17.0]
    at org.apache.activemq.artemis.core.journal.impl.JournalImpl.access0(JournalImpl.java:92) [artemis-journal-2.17.0.jar:2.17.0]
    at org.apache.activemq.artemis.core.journal.impl.JournalImpl.run(JournalImpl.java:1255) [artemis-journal-2.17.0.jar:2.17.0]
    at org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:42) [artemis-commons-2.17.0.jar:2.17.0]
    at org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:31) [artemis-commons-2.17.0.jar:2.17.0]
    at org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:65) [artemis-commons-2.17.0.jar:2.17.0]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [rt.jar:1.8.0_302]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [rt.jar:1.8.0_302]
    at org.apache.activemq.artemis.utils.ActiveMQThreadFactory.run(ActiveMQThreadFactory.java:118) [artemis-commons-2.17.0.jar:2.17.0]
Caused by: java.io.IOException: An unexpected network error occurred
    at sun.nio.ch.FileDispatcherImpl.write0(Native Method) [rt.jar:1.8.0_302]
    at sun.nio.ch.FileDispatcherImpl.write(FileDispatcherImpl.java:75) [rt.jar:1.8.0_302]
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93) [rt.jar:1.8.0_302]
    at sun.nio.ch.IOUtil.write(IOUtil.java:51) [rt.jar:1.8.0_302]
    at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:211) [rt.jar:1.8.0_302]
    at org.apache.activemq.artemis.core.io.nio.NIOSequentialFile.doInternalWrite(NIOSequentialFile.java:434) [artemis-journal-2.17.0.jar:2.17.0]
    at org.apache.activemq.artemis.core.io.nio.NIOSequentialFile.internalWrite(NIOSequentialFile.java:406) [artemis-journal-2.17.0.jar:2.17.0]
    ... 12 more

这些异常来自 JVM 提供的底层 java.nio.channels.FileChannel。 ActiveMQ Artemis 除了报告故障并做出相应响应之外,对它们无能为力。据我所知,从经纪人的角度来看,一切都按照设计进行。与磁盘相关的故障,如您遇到的故障,通常被认为是“严重”故障,这意味着代理在遇到此类错误时将自行关闭。

由于 java.io.IOException 报告“发生意外的网络错误”,看起来您正在使用 network-based 文件系统(例如 NFS)。如果是这样,我建议您确保此文件系统和允许来自代理的连接的网络的完整性。