Uploaded image for project: 'JBoss Marshalling'
  1. JBoss Marshalling
  2. JBMAR-62

AbstractUnmarshaller.readFully can read past end of file

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.2.0.CR3
    • 1.2.0.CR2
    • None
    • None

      AbstractUnmarshaller.readFully() can sometimes read past end of byte input:

      Deleting file /home/galder/tmptarget/tempFiles/FileCacheStoreFunctionalTest
      PASSED: testTwoCachesSameCacheStore
      FAILED: testPreloading
      org.infinispan.CacheException: org.infinispan.loaders.CacheLoaderException: Error while reading from file: /home/galder/tmptarget/tempFiles/FileCacheStoreFunctionalTest/testPreloading/-372149364
      at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:246)
      at org.infinispan.CacheDelegate.put(CacheDelegate.java:326)
      at org.infinispan.CacheDelegate.put(CacheDelegate.java:544)
      at org.infinispan.CacheDelegate.put(CacheDelegate.java:179)
      at org.infinispan.loaders.BaseCacheStoreFunctionalTest.doRunPreloadingTest(BaseCacheStoreFunctionalTest.java:107)
      at org.infinispan.loaders.BaseCacheStoreFunctionalTest.testPreloading(BaseCacheStoreFunctionalTest.java:90)
      Caused by: org.infinispan.loaders.CacheLoaderException: Error while reading from file: /home/galder/tmptarget/tempFiles/FileCacheStoreFunctionalTest/testPreloading/-372149364
      at org.infinispan.loaders.file.FileCacheStore.loadBucket(FileCacheStore.java:162)
      at org.infinispan.loaders.file.FileCacheStore.loadBucket(FileCacheStore.java:148)
      at org.infinispan.loaders.bucket.BucketBasedCacheStore.loadLockSafe(BucketBasedCacheStore.java:31)
      at org.infinispan.loaders.LockSupportCacheStore.load(LockSupportCacheStore.java:97)
      at org.infinispan.loaders.AbstractCacheLoader.containsKey(AbstractCacheLoader.java:16)
      at org.infinispan.interceptors.CacheLoaderInterceptor.loadIfNeeded(CacheLoaderInterceptor.java:116)
      at org.infinispan.interceptors.CacheLoaderInterceptor.visitPutKeyValueCommand(CacheLoaderInterceptor.java:74)
      at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:77)
      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:118)
      at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:132)
      at org.infinispan.commands.AbstractVisitor.visitPutKeyValueCommand(AbstractVisitor.java:57)
      at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:77)
      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:118)
      at org.infinispan.interceptors.TxInterceptor.enlistWriteAndInvokeNext(TxInterceptor.java:185)
      at org.infinispan.interceptors.TxInterceptor.visitPutKeyValueCommand(TxInterceptor.java:127)
      at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:77)
      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:118)
      at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:48)
      at org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:34)
      at org.infinispan.commands.AbstractVisitor.visitPutKeyValueCommand(AbstractVisitor.java:57)
      at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:77)
      at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:237)
      ... 27 more
      Caused by: java.io.EOFException: Read past end of file
      at org.jboss.marshalling.AbstractUnmarshaller.eofOnRead(AbstractUnmarshaller.java:180)
      at org.jboss.marshalling.AbstractUnmarshaller.readFully(AbstractUnmarshaller.java:204)
      at org.jboss.marshalling.river.RiverUnmarshaller.doReadByteArray(RiverUnmarshaller.java:1290)
      at org.jboss.marshalling.river.RiverUnmarshaller.doReadArray(RiverUnmarshaller.java:1358)
      at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:283)
      at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:158)
      at org.jboss.marshalling.AbstractUnmarshaller.readObject(AbstractUnmarshaller.java:81)
      at org.infinispan.container.entries.ImmortalCacheEntry$Externalizer.readObject(ImmortalCacheEntry.java:121)
      at org.infinispan.marshall.jboss.ConstantObjectTable$ExternalizerAdapter.readObject(ConstantObjectTable.java:249)
      at org.infinispan.marshall.jboss.ConstantObjectTable.readObject(ConstantObjectTable.java:236)
      at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:304)
      at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:158)
      at org.jboss.marshalling.AbstractUnmarshaller.readObject(AbstractUnmarshaller.java:81)
      at org.infinispan.loaders.bucket.Bucket$Externalizer.readObject(Bucket.java:115)
      at org.infinispan.marshall.jboss.ConstantObjectTable$ExternalizerAdapter.readObject(ConstantObjectTable.java:249)
      at org.infinispan.marshall.jboss.ConstantObjectTable.readObject(ConstantObjectTable.java:236)
      at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:304)
      at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:158)
      at org.jboss.marshalling.AbstractUnmarshaller.readObject(AbstractUnmarshaller.java:81)
      at org.infinispan.marshall.jboss.JBossMarshaller.objectFromObjectStream(JBossMarshaller.java:206)
      at org.infinispan.marshall.VersionAwareMarshaller.objectFromByteBuffer(VersionAwareMarshaller.java:104)
      at org.infinispan.marshall.AbstractMarshaller.objectFromInputStream(AbstractMarshaller.java:24)
      at org.infinispan.loaders.file.FileCacheStore.loadBucket(FileCacheStore.java:158)
      ... 48 more
      ... Removed 22 stack frames

      Find attached FileCacheStoreFunctionalTest.

      It's john.prince in the Infinispan user forums that reported this and he fixed it by adding the following to the while condition in AbstractUnmarshaller.readFully()

      && len > remaining

              dlloyd@redhat.com David Lloyd
              rh-ee-galder Galder Zamarreño
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: