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

ArrayOutOfBoundException in PooledService#sendFlush (concurrent access on list)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 1.5.0, 1.4.8
    • None
    • Core
    • None

    Description

      Hey,

      PooledService#sendFlush iterates over "endpoints" with an index. But it can happen, concurrently, that someone clears/changes "endpoints". While changes are guarded via epMutex, reading in sendFlush is not.

      IMHO, fix is to make a copy of endpoints (with synchronized(epMutex)) and then iterate over the copy to send the signal.

      This is the stacktrace:

      2017-08-07 16:56:10.479 [cb-core-3-2] WARN com.couchbase.client.core.CouchbaseCore - Exception while Handling Request Events RequestEvent{request=null}
      java.lang.ArrayIndexOutOfBoundsException: 0
      at java.util.concurrent.CopyOnWriteArrayList.get(CopyOnWriteArrayList.java:387)
      at java.util.concurrent.CopyOnWriteArrayList.get(CopyOnWriteArrayList.java:396)
      at com.couchbase.client.core.service.PooledService.sendFlush(PooledService.java:409)
      at com.couchbase.client.core.service.PooledService.send(PooledService.java:315)
      at com.couchbase.client.core.node.CouchbaseNode.send(CouchbaseNode.java:183)
      at com.couchbase.client.core.RequestHandler.flush(RequestHandler.java:211)
      at com.couchbase.client.core.RequestHandler.onEvent(RequestHandler.java:201)
      at com.couchbase.client.core.RequestHandler.onEvent(RequestHandler.java:73)
      at com.couchbase.client.deps.com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:129)
      at com.couchbase.client.deps.io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
      at java.lang.Thread.run(Thread.java:745)
      

      Attachments

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

        Activity

          People

            daschl Michael Nitschinger
            okr2014 okr2014
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty