首页 > 解决方案 > 尝试将大量数据行从文件写入corda时出现内存不足异常

问题描述

我需要将发送的数据注册表文件写入corda。我在“流”中调用“调用”方法。第一行是正常写的。

当我尝试在corda中写入大量数据行时发生错误:

    Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "FiberTimedScheduler-default-fiber-pool"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "FiberTimedScheduler-Same thread scheduler"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "rpc-server-reaper-0"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "RxIoScheduler-1 (Evictor)"
Exception in thread "Timer-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "server-timer" java.lang.OutOfMemoryError: Java heap space
Exception in thread "threadDeathWatcher-3-1" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-1 (activemq-netty-threads)" java.lang.OutOfMemoryError: Java heap space
Exception in thread "RxIoScheduler-2" java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread.
       at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:59)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
       at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-6" java.lang.OutOfMemoryError: Java heap space

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "MVStore background writer nio:C:/Users/Evsin/Desktop/CordaProjectV2/build/nodes/PartyA/persistence.mv.db"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-0 (ActiveMQ-scheduled-threads)"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-1 (ActiveMQ-scheduled-threads)"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-4 (ActiveMQ-scheduled-threads)"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "activemq-failure-check-thread"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-1 (ActiveMQ-client-netty-threads)"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-2 (activemq-netty-threads)"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-3 (activemq-netty-threads)"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-0 (activemq-netty-threads)"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-1 (activemq-netty-threads)"
Exception in thread "Thread-3 (ActiveMQ-client-netty-threads)" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-2 (activemq-netty-threads)" java.lang.OutOfMemoryError: Java heap space

带有代码的图像在这里

标签: javacorda

解决方案


此问题很可能是由堆大小不足引起的。默认情况下,Corda 节点以 512MB 的 Java 堆大小开始。

-Xmx您可以在启动节点时使用命令行参数来增加节点可用的 Java 堆内存量。例如,以下将运行堆大小为 2048MB 的节点:

java -Xmx2048m -jar corda.jar

推荐阅读