4 Replies Latest reply on Jun 26, 2011 5:01 PM by sannegrinovero

    FileCacheStore Nullpointer

    raulraja

      Hi Everyone,

       

      I'm running 5.0.0.CR6 as Hibernate cache and Hibernate Search Lucene store and directory.

      Every time I make  change and it tries to sync or flush I get Nullpointer exceptions.

      I step through the debugger and I can see how the File exist but the call to get the nio channel for the file always returns null.

      I'm including both the exception inline and my Infinispan config xml attached.

       

      Any help is highly appreciated. Thanks!

       

      ---------

       

      Hibernate Search: Directory writer-1 06/23 11:15:23 ERROR org.infinispan.interceptors.InvocationContextInterceptor - ISPN00136: Execution error

      java.lang.NullPointerException

                at org.infinispan.loaders.file.FileCacheStore$BufferedFileSync.purge(FileCacheStore.java:494)

                at org.infinispan.loaders.file.FileCacheStore.purgeFile(FileCacheStore.java:382)

                at org.infinispan.loaders.file.FileCacheStore.updateBucket(FileCacheStore.java:300)

                at org.infinispan.loaders.bucket.BucketBasedCacheStore.storeLockSafe(BucketBasedCacheStore.java:89)

                at org.infinispan.loaders.bucket.BucketBasedCacheStore.storeLockSafe(BucketBasedCacheStore.java:49)

                at org.infinispan.loaders.LockSupportCacheStore.store(LockSupportCacheStore.java:195)

                at org.infinispan.interceptors.CacheStoreInterceptor.visitPutKeyValueCommand(CacheStoreInterceptor.java:211)

                at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:77)

                at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:119)

                at org.infinispan.interceptors.CacheLoaderInterceptor.visitPutKeyValueCommand(CacheLoaderInterceptor.java:82)

                at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:77)

                at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:119)

                at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:133)

                at org.infinispan.commands.AbstractVisitor.visitPutKeyValueCommand(AbstractVisitor.java:60)

                at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:77)

                at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:119)

                at org.infinispan.interceptors.TxInterceptor.enlistWriteAndInvokeNext(TxInterceptor.java:215)

                at org.infinispan.interceptors.TxInterceptor.visitPutKeyValueCommand(TxInterceptor.java:163)

                at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:77)

                at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:119)

                at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:99)

                at org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:64)

                at org.infinispan.commands.AbstractVisitor.visitPutKeyValueCommand(AbstractVisitor.java:60)

                at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:77)

                at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:119)

                at org.infinispan.interceptors.BatchingInterceptor.handleDefault(BatchingInterceptor.java:77)

                at org.infinispan.commands.AbstractVisitor.visitPutKeyValueCommand(AbstractVisitor.java:60)

                at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:77)

                at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:274)

                at org.infinispan.CacheImpl.put(CacheImpl.java:513)

                at org.infinispan.CacheSupport.put(CacheSupport.java:51)

                at org.infinispan.lucene.FileListOperations.deleteFileName(FileListOperations.java:74)

                at org.infinispan.lucene.InfinispanDirectory.deleteFile(InfinispanDirectory.java:229)

                at org.apache.lucene.index.IndexFileDeleter.deleteFile(IndexFileDeleter.java:542)

                at org.apache.lucene.index.IndexFileDeleter.refresh(IndexFileDeleter.java:341)

                at org.apache.lucene.index.DocumentsWriter.flush(DocumentsWriter.java:592)

                at org.apache.lucene.index.IndexWriter.doFlush(IndexWriter.java:3331)

                at org.apache.lucene.index.IndexWriter.flush(IndexWriter.java:3296)

                at org.apache.lucene.index.IndexWriter.prepareCommit(IndexWriter.java:3159)

                at org.apache.lucene.index.IndexWriter.commitInternal(IndexWriter.java:3232)

                at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:3214)

                at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:3198)

                at org.hibernate.search.backend.Workspace.commitIndexWriter(Workspace.java:220)

                at org.hibernate.search.backend.impl.lucene.PerDPQueueProcessor.run(PerDPQueueProcessor.java:109)

                at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)

                at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

                at java.util.concurrent.FutureTask.run(FutureTask.java:138)

                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

                at java.lang.Thread.run(Thread.java:680)

        • 1. Re: FileCacheStore Nullpointer
          raulraja

          I can verify that the call to org.infinispan.loaders.file.FileCacheStore$BufferedFileSync.purge is before org.infinispan.loaders.file.FileCacheStore$BufferedFileSync.write is ever called so there is no mapping from the the path to the FileChannel and it results in the Nullpointer when calling channel.truncate(0);

          Is this a bug that I should report or am I missing something obvious in my config?

           

          thanks

          • 2. Re: FileCacheStore Nullpointer
            sannegrinovero

            Hi,

            thanks for reporting this, it's definitely a bug. Could you open an issue on JIRA please? Feel free to assign it to me, I'm already looking into making a test.

            • 3. Re: FileCacheStore Nullpointer
              raulraja

              ok thanks, created https://issues.jboss.org/browse/ISPN-1200 and attached a patch.

              I have also noticed that even with a small configuration and small amount of lucene indexes if tehre is a lot of activity I get an exception for (Too many files open) from the OS coming from the FileCacheStore. PErhaps some resources not being closed. Also is it really necessary to have a map cache of the FileChannel's ? Just curious.

              • 4. Re: FileCacheStore Nullpointer
                sannegrinovero

                thanks a lot,

                and opened https://issues.jboss.org/browse/ISPN-1202 as well as I could easily see what you're reporting.

                 

                About the Map, I'm not sure what the intention of the author was, but I think it makes sense to keep the channels open and reuse them: that's why it doesn't need to flush for each operation, as several keys are collected in a bucket it means that many keys share the same file, and you also want to make sure nobody is having two handles in write mode on the same file.