This issue has been created
There are 5 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-3ec914ee-6219-4b12-86a4-338fb4eaadbd XWIKI-25216 Open

An error is logged by the Solr indexer when an attachment is deleted while its page is being indexed

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-3da4120c-d549-4cfc-b3c5-37a346582a51 Simon Urli created this issue on 08/Oct/26 14:50
 
Summary: An error is logged by the Solr indexer when an attachment is deleted while its page is being indexed
Issue Type: cid:jira-generated-image-avatar-3ec914ee-6219-4b12-86a4-338fb4eaadbd Bug
Affects Versions: 5.3
Assignee: Unassigned
Components: Search - Solr
Created: 08/Oct/26 14:50
Priority: cid:jira-generated-image-static-major-55c4ef5a-7758-4041-9482-173eaff72264 Major
Reporter: Simon Urli
Description:

Steps to reproduce

  1. Add an attachment to a page
  2. Delete it (or delete the page) right after, before the Solr indexer processed the page update triggered by the addition

For example, with the REST API: attach a file then delete it immediately.

Expected

Nothing is logged: the attachment doesn't exist anymore, and its deletion updates the Solr index anyway.

Actual

The Solr indexer, which indexes a version of the page still listing the attachment, fails to read its content and logs an error with a full stack trace:

ERROR .DocumentSolrMetadataExtractor - Failed to retrieve the content of attachment [Attachment xwiki:XWiki.DefaultSkin@icons.xwiki.favicon144.png]
com.xpn.xwiki.XWikiException: Error number 3002 in 3: The attachment [Attachment xwiki:XWiki.DefaultSkin@icons.xwiki.favicon144.png] (file ...) could not be found in the filesystem attachment store.

or

ERROR .DocumentSolrMetadataExtractor - Failed to retrieve the content of attachment [Attachment xwiki:WikisResourceIT.testAttachmentsOrder@testAttachmentsOrderAbc.txt]
org.xwiki.store.UnexpectedException: Failed to get InputStream
...
Caused by: org.xwiki.store.blob.BlobNotFoundException: Blob not found at path: ...

The index ends up correct (SolrIndexEventListener handles the attachment and document deletion events), so this error is misleading. It's seen on CI with the functional tests which delete the attachments they create right after using them (WikiSkinIT#overrideFaviconWithSkinAttachment, WikisResourceIT#testAttachmentsOrder), and can happen in any test or real usage doing the same.

Proposed fix

In AbstractSolrMetadataExtractor#getContentAsText, when the content cannot be read, check whether the attachment still exists in the stored document: if not, log it at debug level only. The error is kept when the attachment still exists, since its content is then really missing or broken (e.g. XWIKI-16203).

 
 

5 updates

 
cid:jira-generated-image-avatar-3da4120c-d549-4cfc-b3c5-37a346582a51 Changes by Simon Urli on 08/Oct/26 14:50
 
Fix Version: 18.9.0-rc-1
Fix Version: 17.10.14
Fix Version: 18.4.7
Assignee: Simon Urli
Labels: bugfixingday