This issue has been created
 
 
XWiki Platform / cid:jira-generated-image-avatar-1943d839-eb1f-4f6f-b03c-1b5cfafafbc7 XWIKI-24595 Open

DefaultSolrIndexer sends an empty add request to a remote Solr, causing a "missing content stream" error

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-b20d2c4d-9758-43c7-aa91-10e6c3c6155d Vincent Massol created this issue on 23/Jul/26 13:35
 
Summary: DefaultSolrIndexer sends an empty add request to a remote Solr, causing a "missing content stream" error
Issue Type: cid:jira-generated-image-avatar-1943d839-eb1f-4f6f-b03c-1b5cfafafbc7 Bug
Affects Versions: 17.10.10
Assignee: Unassigned
Components: Search - Solr
Created: 23/Jul/26 13:35
Priority: cid:jira-generated-image-static-major-ec4f3b1a-362c-4efe-b813-b610e515ae4e Major
Reporter: Vincent Massol
Description:

When XWiki is configured with a remote Solr, DefaultSolrIndexer.flushDocuments() can issue a Solr add for an empty document batch. SolrJ then POSTs an update request with no body, and the remote Solr's update handler rejects it with missing content stream, logging an ERROR with a stack trace.

This was observed deterministically once, at the very first indexer flush on startup, right after the sync job reported 0 documents added, 0 deleted and 0 updated. Indexing then proceeded normally, so the error appears benign, but it pollutes the log with an ERROR + stack trace.

The most likely explanation is that flushDocuments fires an add for an empty collection instead of skipping the request when there is nothing to send.

Stack trace

2026-07-22 20:46:01,201 [XWiki Solr client thread] ERROR o.x.s.s.i.DefaultSolrIndexer   - Failed to add documents to the Solr server
org.apache.solr.client.solrj.impl.BaseHttpSolrClient$RemoteSolrException: Error from server at http://xwiki-index:8983/solr/xwiki_search_9: missing content stream
        at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:747)
        at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:263)
        at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:244)
        at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:234)
        at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:101)
        at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:68)
        at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:81)
        at org.xwiki.search.solr.internal.AbstractSolrInstance.add(AbstractSolrInstance.java:71)
        at org.xwiki.search.solr.internal.DefaultSolrIndexer.lambda$flushDocuments$3(DefaultSolrIndexer.java:634)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)

Expected behaviour

No request should be sent to Solr when the document batch is empty (guard the add against an empty collection in DefaultSolrIndexer.flushDocuments).

Discovered while testing the official XWiki Docker image with a remote Solr: https://github.com/xwiki/xwiki-docker/pull/90