How To

Exceptions in persistent Store during Startup

Problem

You see something similar to this stack trace during startup of a SwiftMQ Router:

Booting SwiftMQ 12.04.01 Universal Edition [router1] ...
... startup: Trace Swiftlet
... startup: Log Swiftlet
... startup: Authentication Swiftlet
... startup: Threadpool Swiftlet
... startup: Timer Swiftlet
... startup: Network Swiftlet
... startup: Store Swiftlet
+++ RecoveryManager/restarting, processing transaction log...
+++ RecoveryManager/restart, 10% so far...
+++ RecoveryManager/restart, 20% so far...
+++ RecoveryManager/restart, 30% so far...
+++ RecoveryManager/restart, 40% so far...
+++ RecoveryManager/restart, 50% so far...
+++ RecoveryManager/restart, 60% so far...
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
        at java.base/java.util.ArrayList.<init>(ArrayList.java:154)
        at com.swiftmq.impl.store.standard.log.LogRecord.readContent(LogRecord.java:135)
        at com.swiftmq.impl.store.standard.recover.RecoveryManager.restart(RecoveryManager.java:210)
        at com.swiftmq.impl.store.standard.StoreSwiftletImpl.startup(StoreSwiftletImpl.java:288)
        at com.swiftmq.swiftlet.SwiftletManager.startUpSwiftlet(SwiftletManager.java:188)
        at com.swiftmq.swiftlet.SwiftletManager.startKernelSwiftlet(SwiftletManager.java:281)
        at com.swiftmq.swiftlet.SwiftletManager.startKernelSwiftlets(SwiftletManager.java:248)
        at com.swiftmq.swiftlet.SwiftletManager.initSwiftlets(SwiftletManager.java:698)
        at com.swiftmq.swiftlet.SwiftletManager.startRouter(SwiftletManager.java:525)
        at com.swiftmq.Router.main(Router.java:37)

Analytic

The transaction log seems to be corrupt. This may happen if you hard kill the SwiftMQ Router process (i.e., power off the machine) as - per default for performance reasons - the transaction log is not sync'ed with the disk.

Solution

To solve that, delete

data/store/log/transaction.log

and

data/store/db/page.db

and start the router. The data in the persistent store is lost.

To avoid this in the future, avoid a hard kill of the router or use

force-sync="true"

at the sys$store/transaction-log configuration. The latter option will slow down your persistent performance to that of the disk as every write to the transaction log is sync'ed with the disk.