Early EOF — The Client Hung Up Before Solr Finished Reading the Update

Errors
Solr Error Guide

Early EOF

Your application started sending a batch of documents to Solr and hung up before the batch was complete. Solr is fine. The batch that was in flight was not indexed.


What Happened?

The Error: org.eclipse.jetty.io.EofException: Early EOF

An update request carries its documents in the request body. Solr was still reading that body when the connection closed from the other end. "EOF" means end of file: the data ended earlier than the request said it would. Solr cannot index half a batch, so it rejects the whole request.


Why It Happens

Almost always, something on the client side has a time limit, and sending the batch took longer than that limit. The client gives up and closes the connection in the middle of the upload. The usual suspects:

  • The Solr client's own timeout. In Drupal, the Search API Solr server has an Index timeout setting, a few seconds by default. A large batch can take longer than that to send.
  • The hosting platform's execution limit. Managed PHP hosts (Pantheon and others) stop a web request or a cron run after a fixed time. When the limit is reached in the middle of an update, the upload is cut.
  • A batch that is simply too big. Hundreds of large documents in one request make every request slow, so any of the limits above is hit more often.

It is not a slow Solr server. Solr answers the requests that do arrive complete in a fraction of a second; the broken ones never finish arriving.


How to Tell It Is This

  • Your application says everything is indexed (in Drupal, the tracker shows 100%), but the index holds fewer documents than it should.
  • The errors appear only while you are indexing, and stop when indexing stops.
  • The gap is roughly number of Early EOF errors × batch size. Every error is one lost batch.

The Fix: Smaller Batches

Whichever limit is cutting the upload, the fix is the same: send fewer documents per request, so every request finishes well inside the limit. Raising the client timeout helps as well.

Drupal (Search API Solr)

  • Lower the Cron batch size on the index edit form (Configuration, Search and metadata, Search API, your index, Edit). Try 20 or 25 instead of 50 or more.
  • When you index from the command line, pass a smaller batch explicitly.
  • Raise Index timeout in the Search API Solr server settings, under the connector's advanced options.
drush search-api:index your_index --batch-size=20

With the Opensolr Turbo Indexer, set the batch the same way:

drush ost --batch=20

Any other client

SolrJ, pysolr, the Opensolr API or your own code: send fewer documents per update request, and make sure the HTTP timeout of your client is longer than the time one batch takes to upload.


Get the Missing Documents Back

The lost batches were never indexed, so they have to be sent again. Your application believes they are already there, so tell it otherwise first. In Drupal, queue the index for reindexing (the Queue all items for reindexing button on the index page), then run the indexer with the smaller batch size.

drush search-api:reset-tracker your_index
drush search-api:index your_index --batch-size=20

Seen it once or twice? A single Early EOF can also be a network blip or a deploy that restarted your application in the middle of a request. It only needs action when it repeats while you index.