Infinite recursion in reactive subdoc get operation

Description

Suggested release note:

Fixed a regression in 3.4.5 that caused `ReactiveCollection.lookupIn` to always throw `StackOverflowException`.

 

Attempting to use any reactive subdoc get operation using the latest Java client (3.4.5) results in a StackOverflowError due to infinite recursion.

 

Sample code (reproduce using the travel sample data):

var cluster = Cluster.connect("localhost", "username", "password");
cluster.waitUntilReady(Duration.ofSeconds(30));
var bucket = cluster.bucket("travel-sample");
bucket.waitUntilReady(Duration.ofSeconds(30));
var result = bucket.defaultCollection().reactive()
        .lookupIn("airline_10", List.of(LookupInSpec.get("name")))
        .block();
System.out.println(result);

Partial output:

[ WARN] (main) throwIfFatal detected a jvm fatal exception, which is thrown and logged below: - java.lang.StackOverflowError
java.lang.StackOverflowError
    at reactor.core.publisher.Operators.onOperatorError(Operators.java:719)
    at reactor.core.publisher.Operators.onOperatorError(Operators.java:697)
    at reactor.core.publisher.Operators.onOperatorError(Operators.java:679)
    at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:48)
    at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
    at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
    ...hundreds of lines...
    at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
    at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)

This appears to be due to the following method, which does not defer to the corresponding async method as the other reactive methods do, instead calling itself: https://github.com/couchbase/couchbase-jvm-clients/blob/8263a6b445df6c0b7aa072497266d7b6553102b5/core-io/src/main/java/com/couchbase/client/core/api/kv/CoreKvOps.java#L318-L325 

Environment

None

Gerrit Reviews

None

Release Notes Description

None

Activity

Show:

David Nault April 22, 2023 at 12:41 AM

Thank you, Ian. We'll get this fixed for 3.4.6.

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Story Points

Components

Fix versions

Affects versions

Priority

Instabug

Open Instabug

PagerDuty

Sentry

Zendesk Support

Created April 21, 2023 at 1:46 PM
Updated April 22, 2023 at 12:48 AM
Resolved April 22, 2023 at 12:48 AM
Instabug