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

Retrieving design documents from a non-data node causes a null pointer exception

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.3.1
    • 1.3.2
    • Services
    • None

    Description

      When using the method 'bucket.bucketManager().getDesignDocuments()' when there are non-data nodes present in the cluster causes a null pointer exception to be thrown:

      Exception in thread "main" java.lang.NullPointerException
      	at com.couchbase.client.java.bucket.DefaultAsyncBucketManager$3.call(DefaultAsyncBucketManager.java:161)
      	at com.couchbase.client.java.bucket.DefaultAsyncBucketManager$3.call(DefaultAsyncBucketManager.java:150)
      	at rx.internal.operators.OperatorMap$MapSubscriber.onNext(OperatorMap.java:66)
      	at rx.observers.Subscribers$5.onNext(Subscribers.java:229)
      	at rx.internal.producers.SingleProducer.request(SingleProducer.java:65)
      	at rx.Subscriber.setProducer(Subscriber.java:211)
      	at rx.internal.operators.OperatorMap$MapSubscriber.setProducer(OperatorMap.java:99)
      	at rx.Subscriber.setProducer(Subscriber.java:205)
      	at rx.subjects.AsyncSubject.onCompleted(AsyncSubject.java:105)
      	at com.couchbase.client.core.endpoint.AbstractGenericHandler.completeResponse(AbstractGenericHandler.java:348)
      	at com.couchbase.client.core.endpoint.AbstractGenericHandler.access$000(AbstractGenericHandler.java:66)
      	at com.couchbase.client.core.endpoint.AbstractGenericHandler$1.call(AbstractGenericHandler.java:366)
      	at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: rx.exceptions.OnErrorThrowable$OnNextValue: OnError while emitting onNext value: com.couchbase.client.core.message.config.GetDesignDocumentsResponse.class
      	at rx.exceptions.OnErrorThrowable.addValueAsLastCause(OnErrorThrowable.java:109)
      	at rx.internal.operators.OperatorMap$MapSubscriber.onNext(OperatorMap.java:70)
      	... 17 more
      

      I have attached debug level logging with this failure (NPE_failure.log).

      Interestingly it only seems to occur if the node that I connect to in my bootstrap list is non-data.
      If I change my code to bootstrap off of the data node then I don't have this problem, I have attached the log as NPE_success.log.

      The code to reproduce this is very simple:

      import com.couchbase.client.java.Bucket;
      import com.couchbase.client.java.CouchbaseCluster;
       
      public class Main {
          public static void main(String[] args){
              Bucket bucket = CouchbaseCluster.create("10.142.150.101").openBucket("beer-sample");
              System.out.println(bucket.bucketManager().getDesignDocuments());
          }
      }
      

      Attachments

        For Gerrit Dashboard: JVMCBC-354
        # Subject Branch Project Status CR V

        Activity

          daschl Michael Nitschinger added a comment - - edited

          Yep, definitely a MDS bug - thanks for raising we'll get it fixed!

          the weird thing is that the get design documents request goes against 8091, not 8092 and since its available on every node we just send it to all - but i'll look more into it and we can add the MDS logic if thats really the issue

          daschl Michael Nitschinger added a comment - - edited Yep, definitely a MDS bug - thanks for raising we'll get it fixed! the weird thing is that the get design documents request goes against 8091, not 8092 and since its available on every node we just send it to all - but i'll look more into it and we can add the MDS logic if thats really the issue

          after looking into this, the 8091/pools/default/buckets/default/ddocs endpoint that this request uses answers with

          {
            "error": "no_ddocs_service"
          }
          

          It seems like this particular request must go to a kv node (in Java SDK linguo, one with the VIEW service enabled), but still hit port 8091 of course.

          simonbasle Simon Baslé (Inactive) added a comment - after looking into this, the 8091/pools/default/buckets/default/ddocs endpoint that this request uses answers with { "error": "no_ddocs_service" } It seems like this particular request must go to a kv node (in Java SDK linguo, one with the VIEW service enabled), but still hit port 8091 of course.

          People

            simonbasle Simon Baslé (Inactive)
            matt.carabine Matt Carabine
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty