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

A faulty attachment in a document prevents the sending of attachment events for the other attachments when saving

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 16.10.0
    • Old Core
    • None
    • Unknown

    Description

      Here's an example of a stack trace I got during a rename operation:

      No row with the given identifier exists: \[com.xpn.xwiki.doc.XWikiAttachmentContent#220509689\]: \[\<null entity name>#\<null>\]
      class com.xpn.xwiki.XWikiException: Error number 0 in 0: Error number 3231 in 3: Exception while loading attachment Attachment extensions:Extension.Index Application@index-alldocs-docs.png.png
      at com.xpn.xwiki.store.XWikiHibernateAttachmentStore.lambda$loadAttachmentContent$0(XWikiHibernateAttachmentStore.java:251)
      at com.xpn.xwiki.store.XWikiHibernateBaseStore.execute(XWikiHibernateBaseStore.java:851)
      at com.xpn.xwiki.store.XWikiHibernateBaseStore.executeRead(XWikiHibernateBaseStore.java:927)
      at com.xpn.xwiki.store.XWikiHibernateAttachmentStore.loadAttachmentContent(XWikiHibernateAttachmentStore.java:238)
      at com.xpn.xwiki.doc.XWikiAttachment.loadAttachmentContent(XWikiAttachment.java:1125)
      at com.xpn.xwiki.doc.XWikiAttachment.reloadAttachmentContent(XWikiAttachment.java:949)
      at com.xpn.xwiki.doc.XWikiAttachment.getContentInputStream(XWikiAttachment.java:927)
      at com.xpn.xwiki.doc.XWikiDocument.retrieveDeletedAttachment(XWikiDocument.java:7440)
      at com.xpn.xwiki.doc.XWikiDocument.getAttachmentDiff(XWikiDocument.java:7404)
      at com.xpn.xwiki.internal.event.AttachmentEventGeneratorListener.onDocumentUpdatedEvent(AttachmentEventGeneratorListener.java:139)
      at com.xpn.xwiki.internal.event.AttachmentEventGeneratorListener.onEvent(AttachmentEventGeneratorListener.java:88)
      at org.xwiki.observation.internal.DefaultObservationManager.notify(DefaultObservationManager.java:338)
      at org.xwiki.observation.internal.DefaultObservationManager.notify(DefaultObservationManager.java:303)
      at com.xpn.xwiki.XWiki.afterSave(XWiki.java:2042)
      at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:2130)
      

      The problem was that attachment index-alldocs-docs.png.png was broken in the DB.

      However it revealed another issue: if a single attachment is broken, the code at line https://github.com/xwiki/xwiki-platform/blob/456d6149d12d36f5481e70759e7974815591a2c1/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/internal/event/AttachmentEventGeneratorListener.java#L139 will throw an exception and no events will be sent for the other good attachments.

      We probably need to bullet proof https://github.com/xwiki/xwiki-platform/blob/b014ad74dca9d338bbbd3e16afccf8448970db04/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java#L7398 so that it doesn't fail when one attachment fails.

      Attachments

        Activity

          People

            Unassigned Unassigned
            vmassol Vincent Massol
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: