Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-15310

Some attachments disappear from attachment-cache after a period of time

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 10.5-rc-1
    • 10.4
    • Old Core
    • OS: macOS High Sierra 10.13.4
      Servlet: jetty-hsqldb
      JVM Version: 1.8.0_112-b16
    • Unknown
    • N/A
    • N/A

    Description

      I'm creating this issue although it might get marked as duplicate.
      Similar issues are XWIKI-15025 , XWIKI-13396 and I remember another one I cannot find that was about Administration category icons disappearing.

      I've reproduced this issue multiple times (2-5 times by accident), by having local instances opened for periods more than 1 week. It's quite hard to notice it because random attachments get deleted. In some cases there were the Administration category icons (see AdministrationMissing.png), so users noticed that, in order cases it was the custom instance logo.

      If you go to the Page Index, in the Attachment section, you will notice that some of the attachments are missing, see PageIndexMissing.png

      In my particular instance I have attachments missing from Blog.BlogIntroduction, Blog.Categories, XWiki.GoogleAnalyticsCode, XWiki.AdminSheet, XWiki.OfficeImporterAdmin, XWiki.SearchSuggestConfig; but I imagine this is random?

      Trying to open an attachment from the Page Index, will give you this message, see attachmentError.png

      Blog/BlogIntroduction/blog-post-thumbnail.jpg

      Detailed information:
          Error number 0 in 11: Uncaught exception
      com.xpn.xwiki.XWikiException: Error number 0 in 11: Uncaught exception
      	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:486)
      	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:209)
      	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
      	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
      	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
      	at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:860)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650)
      	at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:112)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at org.xwiki.wysiwyg.filter.ConversionFilter.doFilter(ConversionFilter.java:127)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:63)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:111)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:134)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1629)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
      	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:219)
      	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      	at org.eclipse.jetty.server.Server.handle(Server.java:530)
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:347)
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:256)
      	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
      	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
      	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
      	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.RuntimeException: Failed to get InputStream
      	at com.xpn.xwiki.doc.XWikiAttachmentContent.getContentInputStream(XWikiAttachmentContent.java:245)
      	at com.xpn.xwiki.doc.XWikiAttachment.getContentInputStream(XWikiAttachment.java:864)
      	at com.xpn.xwiki.web.DownloadAction.sendContent(DownloadAction.java:303)
      	at com.xpn.xwiki.web.DownloadAction.render(DownloadAction.java:183)
      	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:459)
      	... 51 more
      Caused by: java.io.FileNotFoundException: /private/var/folders/kr/5zlgf_ts25g577yt5qg66_nh0000gp/T/jetty-0.0.0.0-8080-xwiki-_xwiki-any-5199475975916381557.dir/xwiki-temp/attachment-cache/upload_8b296501_0afa_4c29_b4d9_883311b49176_00000147.tmp (No such file or directory)
      	at java.io.FileInputStream.open0(Native Method)
      	at java.io.FileInputStream.open(FileInputStream.java:195)
      	at java.io.FileInputStream.<init>(FileInputStream.java:138)
      	at org.apache.commons.fileupload.disk.DiskFileItem.getInputStream(DiskFileItem.java:220)
      	at com.xpn.xwiki.doc.XWikiAttachmentContent.getContentInputStream(XWikiAttachmentContent.java:243)
      	... 55 more
      

      Another example:
      XWiki/GoogleAnalyticsCode/analytics.png

      Detailed information:
          Error number 0 in 11: Uncaught exception
      com.xpn.xwiki.XWikiException: Error number 0 in 11: Uncaught exception
      	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:486)
      	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:209)
      	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
      	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
      	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
      	at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:860)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650)
      	at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:112)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at org.xwiki.wysiwyg.filter.ConversionFilter.doFilter(ConversionFilter.java:127)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:63)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:111)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:134)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1629)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
      	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:219)
      	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      	at org.eclipse.jetty.server.Server.handle(Server.java:530)
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:347)
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:256)
      	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
      	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
      	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
      	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.RuntimeException: Failed to get InputStream
      	at com.xpn.xwiki.doc.XWikiAttachmentContent.getContentInputStream(XWikiAttachmentContent.java:245)
      	at com.xpn.xwiki.doc.XWikiAttachment.getContentInputStream(XWikiAttachment.java:864)
      	at com.xpn.xwiki.web.DownloadAction.sendContent(DownloadAction.java:303)
      	at com.xpn.xwiki.web.DownloadAction.render(DownloadAction.java:183)
      	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:459)
      	... 51 more
      Caused by: java.io.FileNotFoundException: /private/var/folders/kr/5zlgf_ts25g577yt5qg66_nh0000gp/T/jetty-0.0.0.0-8080-xwiki-_xwiki-any-5199475975916381557.dir/xwiki-temp/attachment-cache/upload_8b296501_0afa_4c29_b4d9_883311b49176_00000100.tmp (No such file or directory)
      	at java.io.FileInputStream.open0(Native Method)
      	at java.io.FileInputStream.open(FileInputStream.java:195)
      	at java.io.FileInputStream.<init>(FileInputStream.java:138)
      	at org.apache.commons.fileupload.disk.DiskFileItem.getInputStream(DiskFileItem.java:220)
      	at com.xpn.xwiki.doc.XWikiAttachmentContent.getContentInputStream(XWikiAttachmentContent.java:243)
      	... 55 more
      

      I've tried to have Thomas's script run.
      Script

      {{velocity}}
      $xwiki.getDocument('XWiki.AdminSheet').isNew()
      
      #set($cacheDocument = $xwiki.getDocument('XWiki.AdminSheet'))
      
      Cached document content: $cacheDocument.title.length()
      Cached document objects: $cacheDocument.document.getXObjects().size()
      
      #set($databaseDocument = $xwiki.getXWiki().hibernateStore.loadXWikiDoc($cacheDocument.document, $xcontext.context))
      
      Cached document content: $databaseDocument.title.length()
      Database document objects: $databaseDocument.getXObjects().size()
      {{/velocity}}
      

      It returned

      false
      
      Cached document content: 199
      Cached document objects: 2
      
      Cached document content: 199
      Database document objects: 2
      

      After running this script, the images for XWiki.AdminSheet got fixed. The other pages are still broken, like Blog.BlogIntroduction, etc.

      Restarting the wiki fixes all the broken images.

      Let me know if you need more information. Thank

      Attachments

        1. AdministrationMissing.png
          AdministrationMissing.png
          405 kB
        2. AdminSheet.png
          AdminSheet.png
          1.00 MB
        3. attachmentError.png
          attachmentError.png
          484 kB
        4. PageIndexMissing.png
          PageIndexMissing.png
          372 kB

        Issue Links

          Activity

            People

              tmortagne Thomas Mortagne
              evalica Ecaterina Moraru (Valica)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: