I have been using BDB-JE with jboss cache for persisting cache entries. In my unit test(single threaded) when I load up the cache with a large number of entries I see the following error(enclosed below). At the time of the error there was about 42M memory available out if a total heap size of 64M. So the heap wasnt quite out of memory. The total amount of data stored in the cache was < 10M. So there should be enough headroom in the heap for managing this data.
jboss cache will write out the node everytime a cache node is created/updated. I noticed initially there were very few log files in the bdb directory (between 4-6). When the error occurred there were 185 log files of sizes between 5-9.8M. Is this expected?
I am using the default BDB JE configuration
BDB JE version: 3.2.68
[testng] Exception in thread "Cleaner-1" java.lang.OutOfMemoryError: Java heap space
[testng] at java.nio.HeapByteBuffer.(Unknown Source)
[testng] at java.nio.ByteBuffer.allocate(Unknown Source)
[testng] at com.sleepycat.je.log.FileReader.copyToSaveBuffer(FileReader.java:718)
[testng] at com.sleepycat.je.log.FileReader.readData(FileReader.java:624)
[testng] at com.sleepycat.je.log.FileReader.readNextEntry(FileReader.java:292)
[testng] at com.sleepycat.je.cleaner.FileProcessor.processFile(FileProcessor.java:411)
[testng] at com.sleepycat.je.cleaner.FileProcessor.doClean(FileProcessor.java:259)
[testng] at com.sleepycat.je.cleaner.FileProcessor.onWakeup(FileProcessor.java:161)
[testng] at com.sleepycat.je.utilint.DaemonThread.run(DaemonThread.java:191)
[testng] at java.lang.Thread.run(Unknown Source)
Following this exception I got a separate exception in the main thread:
Caused by: Environment invalid because of previous exception: com.sleepycat.je.RunRecoveryException
[testng] at com.sleepycat.je.dbi.EnvironmentImpl.checkIfInvalid(EnvironmentImpl.java:976)
[testng] at com.sleepycat.je.dbi.CursorImpl.checkEnv(CursorImpl.java:2624)
[testng] at com.sleepycat.je.Cursor.checkEnv(Cursor.java:1912)
[testng] at com.sleepycat.je.Cursor.checkState(Cursor.java:1902)
[testng] at com.sleepycat.je.Cursor.close(Cursor.java:261)
[testng] at com.sleepycat.je.Cursor.close(Cursor.java:250)
[testng] at org.jboss.cache.loader.bdbje.BdbjeCacheLoader.doPut(BdbjeCacheLoader.java:492)
[testng] at org.jboss.cache.loader.bdbje.BdbjeCacheLoader.put(BdbjeCacheLoader.java:450)
[testng] at org.jboss.cache.interceptors.CacheStoreInterceptor.invoke(CacheStoreInterceptor.java:219)
[testng] at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:77)
[testng] at org.jboss.cache.interceptors.CacheLoaderInterceptor.invoke(CacheLoaderInterceptor.java:180)
[testng] at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:77)
[testng] at org.jboss.cache.interceptors.UnlockInterceptor.invoke(UnlockInterceptor.java:36)
[testng] at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:77)
[testng] at org.jboss.cache.interceptors.PessimisticLockInterceptor.invoke(PessimisticLockInterceptor.java:210)
[testng] at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:77)
[testng] at org.jboss.cache.interceptors.NotificationInterceptor.invoke(NotificationInterceptor.java:32)
[testng] at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:77)
[testng] at org.jboss.cache.interceptors.TxInterceptor.handleNonTxMethod(TxInterceptor.java:298)
[testng] at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:130)
[testng] at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:77)
[testng] at org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:97)
[testng] at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:77)
[testng] at org.jboss.cache.interceptors.InvocationContextInterceptor.invoke(InvocationContextInterceptor.java:62)
[testng] at org.jboss.cache.CacheImpl.invokeMethod(CacheImpl.java:4004)
[testng] ... 34 more
[testng] Caused by: java.lang.OutOfMemoryError: Java heap space
[testng] at java.nio.HeapByteBuffer.(Unknown Source)
[testng] at java.nio.ByteBuffer.allocate(Unknown Source)
[testng] at com.sleepycat.je.log.LogManager.marshallIntoBuffer(LogManager.java:529)
[testng] at com.sleepycat.je.log.LogManager.log(LogManager.java:251)
[testng] at com.sleepycat.je.log.LogManager.log(LogManager.java:186)
[testng] at com.sleepycat.je.tree.LN.log(LN.java:554)
[testng] at com.sleepycat.je.tree.LN.optionalLog(LN.java:429)
[testng] at com.sleepycat.je.tree.LN.modify(LN.java:261)
[testng] at com.sleepycat.je.dbi.CursorImpl.putCurrent(CursorImpl.java:1233)
[testng] at com.sleepycat.je.Cursor.putAllowPhantoms(Cursor.java:869)
[testng] at com.sleepycat.je.Cursor.putNoNotify(Cursor.java:808)
[testng] at com.sleepycat.je.Cursor.putInternal(Cursor.java:762)
[testng] at com.sleepycat.je.Cursor.putCurrent(Cursor.java:384)
[testng] at org.jboss.cache.loader.bdbje.BdbjeCacheLoader.doPut(BdbjeCacheLoader.java:486)
[testng] at org.jboss.cache.loader.bdbje.BdbjeCacheLoader.put(BdbjeCacheLoader.java:450)
[testng] at org.jboss.cache.interceptors.CacheStoreInterceptor.invoke(CacheStoreInterceptor.java:219)
[testng] at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:77)
[testng] at org.jboss.cache.interceptors.CacheLoaderInterceptor.invoke(CacheLoaderInterceptor.java:180)
[testng] at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:77)
[testng] at org.jboss.cache.interceptors.UnlockInterceptor.invoke(UnlockInterceptor.java:36)
[testng] at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:77)
[testng] at org.jboss.cache.interceptors.PessimisticLockInterceptor.invoke(PessimisticLockInterceptor.java:210)
[testng] at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:77)
[testng] at org.jboss.cache.interceptors.NotificationInterceptor.invoke(NotificationInterceptor.java:32)
[testng] at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:77)
[testng] at org.jboss.cache.interceptors.TxInterceptor.handleNonTxMethod(TxInterceptor.java:298)
[testng] at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:130)
[testng] at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:77)
[testng] at org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:97)
[testng] at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:77)
[testng] at org.jboss.cache.interceptors.InvocationContextInterceptor.invoke(InvocationContextInterceptor.java:62)
[testng] at org.jboss.cache.CacheImpl.invokeMethod(CacheImpl.java:4004)