Gravatar for joyceyurh@strateqgrp.com

Question by whyy, Aug 22, 2014 3:17 AM

[Closed] java.util.concurrent.TimeoutException: No response received after 60000

Hi, I installed the windows service and when I load my page, I get the error below (in the coveosearchapi.log), anybody encountered the same error before?

https://developers.coveo.com/display/SearchREST/Installing+the+Windows+Service

Caused by: java.util.concurrent.TimeoutException: No response received after 60000

Thanks.

Gravatar for slangevin@coveo.com

Comment by Simon, Aug 27, 2014 11:03 AM

Hi, do not forget to accept the answer provided below, it will help others with the same issues.

Thank you

1 Reply
Gravatar for mlaporte@coveo.com

Answer by Martin Laporte, Aug 22, 2014 3:21 AM

This tells that the REST API (running in that specific Windows service) couldn't connect to an underlying index (which runs in a separate service, and is downloaded separately). So first I'd ask: you do have an index running somewhere, right? Then, check the config.yml file to ensure the proper hostname + port are configured (port is typically 52810). You also need to provide proper certificate files (cert-ca.pem and ces-iis.p12). The easiest way is to grab those from the index files, under Config/Certificates.

If running the REST API on the same machine as the index, and if the index uses the default path on drive C:, you shouldn't have to change the default config.yml file much.

Gravatar for joyceyurh@strateqgrp.com

Comment by whyy, Aug 22, 2014 3:31 AM

Yes, hostname and port + certificates path all configured. And REST API is on the same machine as the index as well.

I have 2 different pages, both pointing to the same restUri, http://localhost:8882/rest/search. The first page loads without any problem, but the second page is throwing ["ERROR", EndpointCaller, "REST request failed", 503, Object, Object]. And when I checked the coveosearchapi.log, I found the

Caused by: java.util.concurrent.TimeoutException: No response received after 60000

Any way to increase the timeout?

Gravatar for mlaporte@coveo.com

Comment by Martin Laporte, Aug 22, 2014 3:44 AM

60 seconds is already quite a long time, so I doubt increasing the timeout is the solution. Can you provide the query parameters for the query that times out? You should see those in the Chrome Console when using the JS UI framework.

Gravatar for joyceyurh@strateqgrp.com

Comment by whyy, Aug 22, 2014 4:37 AM

q: "(@patno=="SC000211") ('[[@epino]'']') ('[[@epino]'']') ('[[@epino]'']') ('[[@epino]'']') ('[[@epino]'']')"

We configured the xml mapping using AccessorSubQueries, all the sub queries are linked by the "epino".

I have tested the same code on my local, on our VM servers, all working fine. Not sure why it's getting the "REST request failed" in the customer's VM.

Gravatar for mlaporte@coveo.com

Comment by Martin Laporte, Aug 22, 2014 8:09 AM

I'm curious to see the code generating that expression: ('[[@epino]'']') ('[[@epino]'']') ('[[@epino]'']') ('[[@epino]'']') ('[[@epino]'']')"

It doesn't seem like valid query syntax to me (the quotes are all over the place). Also, the [[@field] …] syntax is for performing joins, a potentially costly operation. It's typically used with an expression in place of the "…" in my sample, otherwise you end up performing an 1:1 join with all the content, which boils down to just writing @field, but many order of magnitude more expensive to compute.

Gravatar for joyceyurh@strateqgrp.com

Comment by whyy, Aug 25, 2014 2:54 AM

I managed to figure out what caused the problem. It's the nested queries that I added. The nested queries is to enable search of the content of all the sub-tabs (retrieved from sub queries) based on @epino. The original code looks like this:

cont next comment..

Gravatar for joyceyurh@strateqgrp.com

Comment by whyy, Aug 25, 2014 2:54 AM

var currKeyword = $('#Info').coveo('state', 'q');

if (currKeyword != ""){ data.queryBuilder.expression.remove(currKeyword);
}

data.queryBuilder.expression.add('\'[[@epino]\''+currKeyword+'\']\''); data.queryBuilder.filterField = "@epino"; data.queryBuilder.filterFieldRange = 100; data.queryBuilder.expression.build();

I managed to solve the problem by moving the 4 lines of data.queryBuilder into the if statement.

I would like to know whether did I create the expressions correctly? Will it caused performance issue again if I have more data?

Thanks.

Gravatar for mlaporte@coveo.com

Comment by Martin Laporte, Aug 25, 2014 6:13 AM

You don't need to call build() yourself; anyway this only generates the query as a string and returns it. It has no side effect. The framework calls it at the proper time.

Indeed by putting the code that changes the query for a nested query inside the IF you'll avoid doing it for empty strings, which is some kind of a worst case scenario when using nested queries. Still, in your original dump the nested query was present several times in the final query sent to the REST server. Is that still the case when keywords are present? In a perfect world it'd be included only once…

Gravatar for joyceyurh@strateqgrp.com

Comment by whyy, Aug 26, 2014 2:32 AM

what do you mean when you said "which is some kind of a worst case scenario when using nested queries.". Does that mean it should always run the nested queries even no keyword is entered?

No, it's only included once now…

Gravatar for mlaporte@coveo.com

Comment by Martin Laporte, Aug 26, 2014 3:19 AM

I meant that a nested query that looks like this: [[@field] ] takes longer to execute than [[@field] some keywords]. So avoiding "empty" nested queries when we have no keywords helps with query performance.

An empty nested query boils down to the same result set as a simple field expression (@field), meaning that it'll match any document that has the field set.

Gravatar for joyceyurh@strateqgrp.com

Comment by whyy, Aug 26, 2014 10:19 PM

Oh, Ok. I already added the checking to avoid empty nested queries.

However, I still feel the performance is a bit slow.When I entered a keyword, it can take up to 40 seconds to return the search results.

Is this the correct way to create a nested query? data.queryBuilder.expression.add(''[[@epino]''+currKeyword+'']'');

Do I need the following two lines? data.queryBuilder.filterField = "@epino"; data.queryBuilder.filterFieldRange = 100;

Thanks.

Gravatar for mlaporte@coveo.com

Comment by Martin Laporte, Aug 27, 2014 3:17 AM

Woah 40 seconds is way more than a bit slow! Typical query times are in the sub-second range, so there is definitively something amiss.

What is the type of the field you're using (in the index)? If it's a String, please make sure that it's flagged as a facet. You might also need to rebuild the source afterwards.

And if the values in the field are numeric, you might get a big performance boost by using a Numeric field instead.

There might be other stuff, but it's slightly outside my area of expertise --- I'll send this question to someone from the index team.

Gravatar for joyceyurh@strateqgrp.com

Comment by whyy, Sep 1, 2014 9:13 PM

Type of field = string, and yes, I did flagged it as a facet.

Gravatar for mlaporte@coveo.com

Comment by Martin Laporte, Sep 2, 2014 5:47 AM

I got an answer from the index folks. You need to add your fields to a special list that identity your field as being used for nested queries. This enables special optimizations for this field.

Sadly, there is no way to set this using the UI, so you'll have to edit the XML index configuration manually. In your index folder, under the Config subfolder you'll find the Config.txt file. Stop the index service, open the file in a text editor, and locate the tag. Inside this tag, add this XML snippet:

@epino

Save, and then restart the index.

Gravatar for joyceyurh@strateqgrp.com

Comment by whyy, Sep 4, 2014 8:49 PM

When you said "restart the index", did you mean a rebuild is needed?

Gravatar for joyceyurh@strateqgrp.com

Comment by whyy, Sep 4, 2014 9:18 PM

Do I need to put inside the respective ? Or i just need to put in the tag?

Also, restart the index = rebuild?

Gravatar for mlaporte@coveo.com

Comment by Martin Laporte, Sep 5, 2014 5:39 AM

Only . And Restart means restarting the service. No need to rebuild the sources.

Gravatar for joyceyurh@strateqgrp.com

Comment by whyy, Sep 7, 2014 7:51 PM

Hmm okie. I tried, stop the service, then added under physicalindex, but don't see much improvements on performance (based on query duration on screen). Any way to check whether performance improved? any of the logs?

Gravatar for joyceyurh@strateqgrp.com

Comment by whyy, Sep 8, 2014 1:23 AM

Also, how can I add more than one field?

I have another page use a different custom field in the nested query, @patno.

Can I do like this? @epino @patno

Gravatar for joyceyurh@strateqgrp.com

Comment by whyy, Sep 8, 2014 1:24 AM

Also, how can I add more than one field?

I have another page use a different custom field in the nested query, @patno.

Can I do like this?

@epino @patno

Gravatar for mlaporte@coveo.com

Comment by Martin Laporte, Sep 8, 2014 7:35 AM

You can enter multiple fields by separating them with semicolons (;).

For the performance issue, yes there are many ways to get profiling information about queries, but I think we've reached the point where you should open an official case with support, as it falls quite outside of my expertise. Refer to this question in the case so the support chaps have some background.

Gravatar for joyceyurh@strateqgrp.com

Comment by whyy, Sep 8, 2014 9:10 PM

ok.

thanks a lot for your help.

Ask a question