• Not Answered

Rebuilding the Sitecore index gives timeout error

 have setup SOLR 5.5 with Sitecore 8.1 Update 2, however rebuilding the Sitecore master index gives me the below error.
I have used basic_configs configset to create Sitecore_master_index core. Please help as I am getting this issue in production environment.


Job started: Index_Update_IndexName=sitecore_master_index|#Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> SolrNet.Exceptions.SolrConnectionException: The operation has timed out ---> System.Net.WebException: The operation has timed out

   at System.Net.HttpWebRequest.GetResponse()

   at HttpWebAdapters.Adapters.HttpWebRequestAdapter.GetResponse()

   at SolrNet.Impl.SolrConnection.GetResponse(IHttpWebRequest request)

   at SolrNet.Impl.SolrConnection.PostStream(String relativeUrl, String contentType, Stream content, IEnumerable`1 parameters)

   --- End of inner exception stack trace ---

   at SolrNet.Impl.SolrConnection.PostStream(String relativeUrl, String contentType, Stream content, IEnumerable`1 parameters)

   at SolrNet.Impl.SolrConnection.Post(String relativeUrl, String s)

   at SolrNet.Commands.OptimizeCommand.Execute(ISolrConnection connection)

   at SolrNet.Impl.SolrBasicServer`1.SendAndParseHeader(ISolrCommand cmd)

   at SolrNet.Impl.SolrBasicServer`1.Optimize(CommitOptions options)

   at Sitecore.ContentSearch.SolrProvider.SolrSearchIndex.PerformRebuild(Boolean resetIndex, Boolean optimizeOnComplete, IndexingOptions indexingOptions, CancellationToken cancellationToken)

   at Sitecore.ContentSearch.SolrProvider.SolrSearchIndex.Rebuild(Boolean resetIndex, Boolean optimizeOnComplete)

   --- End of inner exception stack trace ---

   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)

   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)

   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)

   at (Object , Object[] )

   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)

   at Sitecore.Jobs.Job.ThreadEntry(Object state)


From the SOLR admin dashboard, I can see the below


 [   x:sitecore_master_index] o.a.s.u.DirectUpdateHandler2 start commit{,optimize=true,openSearcher=true,waitSearcher=true,expungeDeletes=false,softCommit=false,prepareCommit=false}

[   x:sitecore_master_index] o.a.s.u.DirectUpdateHandler2 Starting optimize... Reading and rewriting the entire index! Use with care.

6 Replies

  • Hello Ritesh,

    Have you configured SOLR connection string correctly?

    Verify your SOLR connection:
    localhost:8983/.../select (or whatever)

    You can see step by step guide for SOLR configuration at:

    Thank you,
  • In reply to Nilesh Thakkar:

    Hi Nilesh,

    Yes, it is configured correctly and used the guide as reference. I have configured SOLR cloud and though all the other indexes are rebuilt successfully. I am having timeout issues while rebuilding the master index in production. The same configuration works fine in Test environment.

  • In reply to Ritesh Kumar:

    Hi Ritesh,

    Is this timeout occurring right away or does it index some items before it happens? I've had a similar problem where the indexing randomly stops with a timeout exception from Sitecore. In my case it seems to be a combination of JRE garbage collection etc that temporary slows down Solr, and Sitecore not being very graceful to Solr.

    Best regards
    // Mikael
  • In reply to Mikael Högberg:

    Hi Mikael,

    The indexing reaches to the last item (say 67000) and then it optimizes as I can see in the SOLR log from dashboard. Within few minutes the index timeouts with the error shown above. I increased the JVM-Memory but still the issue was observed.

  • In reply to Ritesh Kumar:

    Hi Ritesh

    This sounds like the same type of issues that I've had as well. Unfortunately I haven't find a stable solution for it.

    There are however a few things to consider:
    * Don't rebuild many indexes at the same time from the Control Panel. Or at least, build the master and web indexes, and other large indexes separately.
    * If you run separate CD servers with separate indexes, build your own little function (handler, page or similar. Make sure to protected it!) that calls ContentSearchManager.GetIndex("indexname").Rebuild(). This is the way I've managed to rebuild web indexes. For some strange reason, building them from within Sitecore almost always fails. (Don't know why)

    Best regards
    // Mikael
  • In reply to Mikael Högberg:

    Hi Mikael,

    Please check the below link as I also raised a ticket with Sitecore to get the suggested patch to fix the issue.


    Comment in the link:
    We have run into the same issue with Sitecore 7.2 and Solr. The issue occurs in the "optimizing" stage of index rebuild. We worked with Sitecore Support and they provided us a patch for the same (issue #405677). This fix is dependent on the IoC library you are using. The patch we got from Sitecore was for Castle Windsow IoC library.
    You may want to reach out to Sitecore Support and get a patch.