Couchbase java client 2.6.0 - single insert fails with timeout


#1

FYI. I’ve just tried to upgrade to the Java SDK 2.6.0, and the following code (from the examples) now returns a TimeoutException when you specify the PersistTo.ONE parameter.

    // Generate a number of dummy JSON documents
    int docsToCreate = 100;
    List<JsonDocument> documents = new ArrayList<JsonDocument>();
    for (int i = 0; i < docsToCreate; i++) {
        JsonObject content = JsonObject.create()
                .put("counter", i)
                .put("name", "Foo Bar");
        documents.add(JsonDocument.create("doc-"+i, content));
    }

    // Insert them in one batch, waiting until the last one is done.
    Observable
            .from(documents)
            .flatMap(new Func1<JsonDocument, Observable<JsonDocument>>() {
                @Override
                public Observable<JsonDocument> call(final JsonDocument docToInsert) {
                    return bucket.async().insert(docToInsert);
                }
            })
            .last()
            .toBlocking()
            .single();

Dave.


#2

Gotten to the root cause.

I have had an increase in disc latency, that the 2.5.4 client swallows, and the 2.6.0 client reports a TimeoutException for.

Regards.

Dave.


#3

@david.richardson I’ve investigated this and I think you are running into https://issues.couchbase.com/browse/JCBC-1223 as well. I’m jumping on it right now, but as a workaround please always on the async API specify an explicit timeout. Hope this helps,