What is Closed status of N1qlQueryResult couchbase


#1

'm just getting status closed in in some intermittent Select query call to Couchbase in N1qlQueryResult object.

I’m just getting status closed in in some intermittent Select query call to Couchbase in N1qlQueryResult object.

As per Couchbase documentation :

Returns the final status of the query. For example, a successful query will return "success" (which is equivalent to finalSuccess() returning true). Other statuses include (but are not limited to) "fatal" when fatal errors occurred and "timeout" when the query timed out on the server side but not yet on the client side. This method blocks until the query is over and the status can be established.

The issue is coming when calling query() method:

public List execute(String query, ScanConsistency scanConsistency) {
final Bucket couchbaseBucket = getSampleCouchbaseBucket(); // get couchbase bucket here
final N1qlQueryResult result = couchbaseBucket.query(N1qlQuery.simple(query, N1qlParams.build().consistency(ScanConsistency.NOT_BOUNDED)));

    if (!SUCCESS.equals(result.status())) {
        throw new RuntimeException(//get errors here);
    }
    return result.allRows();
}

I have now info about statuses [success, timeout, fatal]. But I’m wondering with status closed multiple times. So my question is -

1.What are the statuses other than [success, timeout, fatal] Couchbase returns in N1qlQueryResult what could be scenario for these statuses  as I dont have any specific scenario to reproduce it.
  1. What could be the possible causes for status Closed.

I’m using Couchbase 5.1 with Spring boot 1.5.9 .


#2

“Closed” status means client is closed the connection. cc @marcoeg


#3

You should never see a status of “Closed” on the client side, because it means that the connection has been closed on the client side, so there’s no way that the N1QL service would have sent that status over a closed connection!
I am a bit puzzled.
Let me investigate it a bit more…
@daschl does this ring a bell?


#4

Hello, is there any news concerning this issue as I am experiencing the same symptom (a result with a closed status) with spring-data-couchbase 2.1.11. RELEASE which use couchbase Java client 2.2.8 ?

The problem appears when i stress test the client with more than 2 threads with a 100 loop.
My query take around 30ms.

Why the client would close the connection ?
I have already overided the known timeout param to make sure it’s not comming from it:

maxRequestLifetime
queryTimeout
searchTimeout
viewTimeout
connectTimeout
kvTimeout
socketConnectTimeout
managementTimeout
autoreleaseAfter
keepAliveInterval

Thanks !


#5

@omarnhg9 can you provide trace logs from the time of the incident?


#6

There is no error logs.

Using Bucket#query(N1qlQuery.simple(statement)), i am having this N1qlQueryResult:

image


#7

For the same query, i am having this too :

image

I am doing my test using Jmeter, 10 thread executing simultaniuosly the same query.
I am getting the two response.
The ratio of the closed increase with the number of thread/query.

Thansk.


#8

The server side vision about those closed request (have changed the threshold_limit)

@daschl Forgot to mention that the query are trgiggered by a webservice call.
It’s a rest api deployed on tomcat (spring-boot).
But i can reproduce easly the issue with a simple main that spawn 10 threads and do the query.
I doubt a concurrency bug which force the client to close the connection. What do you think ?

Thanks.


#9

Is there anyone from couchbase SDK team who can help on this ?