Uploaded image for project: 'Java Couchbase JVM Core'
  1. Java Couchbase JVM Core
  2. JVMCBC-641

SDK3: query can intermittently race and fail to deliver rows

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 2.0.0-alpha.2
    • None
    • None
    • None
    • 1

    Description

      In this code, intermittently in testing I'll see it go down the exception path:

            ```new JsonPointer("/results/-", (JsonPointerCB1) value -> {
              if (!currentRequest.completed()) {
                this.currentRequest.succeed(this.currentResponse);
              }
              byte[] data = new byte[value.readableBytes()];
                value.readBytes(data);
                value.release();
                if (!currentResponse.isCompleted()) {
                  if (currentResponse.rowRequestSize() != 0 && currentResponse.rows().getPending() == 0) {
                    currentResponse.rows().onNext(data);
                    currentResponse.rowRequestCompleted();
                  } else {
                    currentResponse.completeExceptionally(
                            new QueryStreamException(currentResponse.rowRequestSize() == 0 ? "No row requests"
                                    : "Current row responses are not consumed"));
                  }
                }
            }),``` 

      My initial thoughts are that this is happening:

      a) telling the subscriber to the request that the request is done
      b) here the subscriber should subscribe to the currentResponse.rows(), which presumably also requests some rows (backpressure)
      c) however, if that hasn't happened by the currentResponse.rowRequestSize() check, the code will fail
      e.g. think there's a race

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            daschl Michael Nitschinger
            graham.pople Graham Pople
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty