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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 17.10.10
    • Search - Solr
    • None
    • Unknown

    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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated: