Couchbase query stuck

hey,
i am using couchbase community 6.0.0 with the latest client
i got a 5,000,000 documents and 3 indexes
i got got query that run on the index with full coverage,
using the java client the query got stick and no result return ,
but if i am using the curl with same query against the database its run with no problems at all
mean the problem in the java client .
there is no laod ( 1 query )
what can cause it and how can i diagnose it ?

here is the explain plain of the query :
{
“plan”: {
#operator”: “Sequence”,
“~children”: [
{
#operator”: “IndexScan3”,
“covers”: [
“cover ((customData.fieldType))”,
“cover ((customData.customerGid))”,
“cover ((customData.dataSetName))”,
“cover ((customData.dataSetVersion))”,
“cover ((customData.companyNameField))”,
“cover ((customData.fieldValueOutputData))”,
“cover ((meta(customData).id))”
],
“index”: “idx_fieldType_customerGid_dataSet_version_companyNameField”,
“index_id”: “888d7dbadf66a97a”,
“index_projection”: {
“entry_keys”: [
0,
1,
2,
3,
4,
5
]
},
“keyspace”: “customData”,
“namespace”: “default”,
“spans”: [
{
“exact”: true,
“range”: [
{
“high”: ““FILE_ROW””,
“inclusion”: 3,
“low”: ““FILE_ROW””
},
{
“high”: ““customerGid””,
“inclusion”: 3,
“low”: ““customerGid””
},
{
“high”: ““dataSet””,
“inclusion”: 3,
“low”: ““dataSet””
},
{
“high”: “1”,
“inclusion”: 3,
“low”: “1”
},
{
“high”: ““eee4224c-d731-4f9d””,
“inclusion”: 3,
“low”: ““eee4224c-d731-4f9d””
}
]
}
],
“using”: “gsi”
},
{
#operator”: “Parallel”,
“~child”: {
#operator”: “Sequence”,
“~children”: [
{
#operator”: “Filter”,
“condition”: “(((((cover ((customData.fieldType)) = “FILE_ROW”) and (cover ((customData.customerGid)) = “customerGid”)) and (cover ((customData.dataSetName)) = “dataSet”)) and (cover ((customData.dataSetVersion)) = 1)) and (cover ((customData.companyNameField)) = “eee4224c-d731-4f9d”))”
},
{
#operator”: “InitialProject”,
“result_terms”: [
{
“expr”: “cover ((customData.fieldValueOutputData))”
}
]
},
{
#operator”: “FinalProject”
}
]
}
}
]
},
“text”: “SELECT fieldValueOutputData FROM customData WHERE fieldType = “FILE_ROW” AND customerGid = “customerGid” AND dataSetName = “dataSet” AND dataSetVersion = 1 AND ( companyNameField = “eee4224c-d731-4f9d” )”
}

also in the log:

eptember 25th 2019, 10:15:01.195 WARN WARN [2019-09-25 07:15:01,194] com.couchbase.client.core.endpoint.AbstractGenericHandler: [couchbase-6-0-0.lsqa.svc.cluster.local/10.32.7.11:8093][QueryEndpoint]: Got error while consuming KeepAliveResponse.
;
September 25th 2019, 10:15:01.195 - ! java.util.concurrent.TimeoutException: null
;

Plan seems to optimal. You should run through Query workbench and see what is going on and analyze PlanText tab output.

i did and it run very fast
what i did for now is doing direct rest to the query serve and its working,
the problem is in the java client that hang up

If the client is failing to receive a keepalive response that might just indicate you have a long running query going. Perhaps you need a longer than the 75s default timeout for this query. You can set that from the query().

is sound not reasonable, its one query and is run very fast on the couchbase query and also
when we run it with curl its run with 100 tps with no problem , and as you can see it has optimal index utilization,
so what else we can check in order to understand what going on in the client that hang it out ? ( java )

It’s not likely to be the Java client itself. Nearly always, we find the timeout is an effect, not the cause.

One thing I do not see here is an example of how you’re issuing the query() in Java. Or an explanation of which version. All of the recent Java clients have a message associated with the timeout. The only timeout you’ve posted is the keepalive, which may indeed timeout if you have a long running query.

As an example, if your code is receiving individual rows and doing something significant with the results, it may not read the query fast enough to complete it under the timeout. We’ve also seen errors in code with the asynchronous API.

Is your code just a simple case like in the documentation?

https://docs.couchbase.com/java-sdk/2.7/n1ql-queries-with-sdk.html#querying-asynchronously

yes its very simple :slight_smile::

    log.info("executing query {} ", query.statement().toString());

    bucket.async().query(query)
            .flatMap(AsyncN1qlQueryResult::rows)
            .filter(Objects::nonNull)
            .filter(row -> Objects.nonNull(row.value().get("fieldValueOutputData")) && StringUtils.isNotEmpty(row.value().get("fieldValueOutputData").toString()))
            .map(row -> row.value().get("fieldValueOutputData").toString())
            .subscribe(new Subscriber<String>() {
                Map<String, String> customRows = new HashMap<>();

and also you can see in the explain plan the query is efficiency , and if i run it directly with rest to the query engine its all runs very fast even with 100tps !

so any thing to do with it?

@raviverel does it work if you use the blocking API instead e.g. bucket.query()?

i havnt test it with the blocking because in previous test in other modules , it performed very bad

Just for debugging, to see if the issue is with how the async API is being used.