11

Here is the error:

Job started: Index_Update_IndexName=Coveo_web_index|#Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Coveo.Framework.Utils.Rest.HttpClientException: Failed to obtain resource located at 'http://DOMAIN.com/coveo/rest?indexName=Coveo_web_index'.
[BEGIN RESPONSE BODY]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>502 - Web server received an invalid response while acting as a gateway or proxy server.</title>
<style type="text/css">
<!--
body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}
fieldset{padding:0 15px 10px 15px;} 
h1{font-size:2.4em;margin:0;color:#FFF;}
h2{font-size:1.7em;margin:0;color:#CC0000;} 
h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;} 
#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;
background-color:#555555;}
#content{margin:0 0 0 2%;position:relative;}
.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}
-->
</style>
</head>
<body>
<div id="header"><h1>Server Error</h1></div>
<div id="content">
 <div class="content-container"><fieldset>
  <h2>502 - Web server received an invalid response while acting as a gateway or proxy server.</h2>
  <h3>There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.</h3>
 </fieldset></div>
</div>
</body>
</html>
[END RESPONSE BODY] ---> System.Net.WebException: The remote server returned an error: (502) Bad Gateway.
   at System.Net.HttpWebRequest.GetResponse()
   at Coveo.Framework.Utils.Rest.HttpClient.ExecuteRequest(String p_Url, HttpWebRequest p_Request, Int64 p_CallId)
   --- End of inner exception stack trace ---
   at Coveo.Framework.Utils.Rest.HttpClient.ExecuteRequest(String p_Url, HttpWebRequest p_Request, Int64 p_CallId)
   at Coveo.Framework.Utils.Rest.HttpClient.PostRaw(String p_Url, String p_Body)
   at Coveo.Framework.Utils.Rest.HttpClient.Post(String p_Url, String p_Body)
   at Coveo.SearchServiceProvider.Rest.ClientSessionWrapper.ExecuteQuery(QueryParams p_QueryParams)
   at Coveo.AbstractLayer.Communication.CES.CESCommunication.<>c__DisplayClass3b.<CreateDeletedDocumentsPoller>b__3a()
   at Coveo.Framework.Synchronization.Poller.WaitUntilComplete()
   at Coveo.AbstractLayer.Communication.CES.CESCommunication.StopRebuild(RebuildContext p_Context)
   at Coveo.SearchProvider.ProviderIndexBase.PerformRebuild(IProviderUpdateContext p_Context, Action`1 p_CrawlerAction)
   at Coveo.SearchProvider.ProviderIndexBase.Rebuild(IndexingOptions p_IndexingOptions, IProviderUpdateContext p_Context, Action`1 p_CrawlerAction)
   at Coveo.SearchProvider.ProviderIndex.TryPerformIndexingOperation(IndexingOptions p_IndexingOptions, Action p_Action)
   at Coveo.SearchProvider.ProviderIndex.Rebuild()
   --- 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 Sitecore.Reflection.ReflectionUtil.InvokeMethod(MethodInfo method, Object[] parameters, Object obj)
   at Sitecore.Jobs.JobRunner.RunMethod(JobArgs args)
   at (Object , Object[] )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Jobs.Job.ThreadEntry(Object state)
13
  • Looks like it maxed out! What's the performance like on the server while indexing - high CPU, memory usage?
    – Ian Graham
    Commented Oct 10, 2016 at 20:50
  • @IanGraham the cpu and memory are around 30% at the max both on the CM initiating the request and also the similar numbers on the CES server.
    – ASura
    Commented Oct 10, 2016 at 20:54
  • Could it be data? Is the there any indication of what item it's failing at, and if so, is it the same one each time? Commented Oct 11, 2016 at 1:04
  • Its most probably its data but catching it is a pain. I have done similar exercises in the past and you would need to grab the last item from the queue and investigate. The funny thing is that there are no errors in any logs.
    – ASura
    Commented Oct 11, 2016 at 2:02
  • 1
    Your error happens when we are polling to check if the old documents are deleted. This means your items should be indexed and deleted correctly. Coveo for Sitecore queries CES to check if the new changes done by the rebuild are completed, so you know when everything is committed in the index and have feedback about it :) Any error in the diagnostic page? Have you tried to access the URL up there to see if this error pops up there? Commented Oct 12, 2016 at 11:56

1 Answer 1

5

So turns out that this issue is a bit more complicated. After troubleshooting for days we figured out that this was a redirection issue. Nothing in the application but its how Coveo 4 handles redirection.

CM Site: https://cm.mysite.com CES Site: http://myCESServer

From Coveo 4 on, the server side Linq to Search requests go through the Coveo Search API via a secured POST call.

The client side js api calls the Coveo Search API using a get call.

Get can move between https and http without an issue but POST on the other hand cannot.

When the query was run on the CM server using Linq to Search (https://cm.mysite.com/somepagewhichrunsquery), it generates a post request and (HERE IS WHERE IT GOES WRONG) posts it to the non https version of the url http://cm.mysite.com/coveo/rest this forces the NLB to push it to https and this causes the search to end up as @uri instead.

This issue causes many others. My other ticket related to coveo indexing 1300+ items also suffers from the same issue.

How do we fix this? Well. For us, we needed a hotfix for Coveo July 2016 release since we were already in production.

But this fix is going to be part of the October 2016 release - which is due to be release in a couple of days.

You can find the downloads at developers.coveo.com/display/public/SitecoreV4/Downloads

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.