Hi All,
Sometimes we are getting this nullpointer errors. Are there any suggestions about this error.
Thanks
07:15:45.861 [cb-core-3-2] WARN c.c.client.core.CouchbaseCore - Exception while Handling Request Events RequestEvent{request=null}, {}
java.lang.NullPointerException: null
at com.couchbase.client.core.node.locate.KeyValueLocator.locateForCouchbaseBucket(KeyValueLocator.java:97) ~[com.couchbase.client.core-io-1.1.3.jar:1.1.3]
at com.couchbase.client.core.node.locate.KeyValueLocator.locate(KeyValueLocator.java:75) ~[com.couchbase.client.core-io-1.1.3.jar:1.1.3]
at com.couchbase.client.core.RequestHandler.onEvent(RequestHandler.java:188) ~[com.couchbase.client.core-io-1.1.3.jar:1.1.3]
at com.couchbase.client.core.RequestHandler.onEvent(RequestHandler.java:73) ~[com.couchbase.client.core-io-1.1.3.jar:1.1.3]
at com.couchbase.client.deps.com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:128) ~[com.couchbase.client.core-io-1.1.3.jar:1.1.3]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_25]
at com.couchbase.client.deps.io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) [com.couchbase.client.core-io-1.1.3.jar:1.1.3]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_25]
07:16:15.761 [cb-core-3-2] WARN c.c.client.core.CouchbaseCore - Exception while Handling Request Events RequestEvent{request=null}, {}
java.lang.NullPointerException: null
07:22:55.901 [cb-core-3-2] WARN c.c.client.core.CouchbaseCore - Exception while Handling Request Events RequestEvent{request=null}, {}
java.lang.NullPointerException: null
07:23:25.801 [cb-core-3-2] WARN c.c.client.core.CouchbaseCore - Exception while Handling Request Events RequestEvent{request=null}, {}
java.lang.NullPointerException: null
07:26:02.821 [cb-core-3-2] WARN c.c.client.core.CouchbaseCore - Exception while Handling Request Events RequestEvent{request=null}, {}
java.lang.NullPointerException: null
07:30:05.941 [cb-core-3-2] WARN c.c.client.core.CouchbaseCore - Exception while Handling Request Events RequestEvent{request=null}, {}
java.lang.NullPointerException: null
07:30:35.841 [cb-core-3-2] WARN c.c.client.core.CouchbaseCore - Exception while Handling Request Events RequestEvent{request=null}, {}
java.lang.NullPointerException: null
daschl
June 26, 2015, 8:43am
2
@yadiguzel I just checked the code, and it looks like this is the code where we turn the key into a byte array.
Can you describe the workload you’re running? We need to track down a potential null key somewhere in your code. Maybe can you also share the code?
* @param nodes the managed nodes.
* @param config the bucket configuration.
* @return an observable with one or more nodes to send the request to.
*/
private Node[] locateForCouchbaseBucket(final BinaryRequest request, final Set<Node> nodes,
final CouchbaseBucketConfig config) {
String key = request.key();
CRC32 crc32 = new CRC32();
try {
crc32.update(key.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
long rv = (crc32.getValue() >> 16) & 0x7fff;
int partitionId = (int) rv & config.numberOfPartitions() - 1;
request.partition((short) partitionId);
int nodeId;
if (request instanceof ReplicaGetRequest) {
nodeId = config.nodeIndexForReplica(partitionId, ((ReplicaGetRequest) request).replica() - 1);
@daschl here is my code in getWithCas method i can check whether is null or not. But this id is session id it can’t be null.
Our workload is not huge about 4000 req/s on each bucket in normal conditions. I could be up to 8K req/s.
object CouchbaseConnectionService extends Configuration with Logging {
val environment : CouchbaseEnvironment = DefaultCouchbaseEnvironment.builder().build()
val cluster = CouchbaseCluster.create(config.getConfig(“couchbase”).getStringList(“servers”))
val sessionBucket = cluster.openBucket(“Sessions”)
val tracksBucket = cluster.openBucket(“Tracks”)
val usersBucket = cluster.openBucket(“Users”)
val logsBucket = cluster.openBucket(“Logs”)
val empty = Some((JsonObject.empty(), 0))
def resolveBucket(name: String): Bucket = {
name match {
case “Sessions” => sessionBucket
case “Tracks” => tracksBucket
case “Users” => usersBucket
case “Logs” => logsBucket
case _ => sessionBucket
}
}
def query(q: ViewQuery, from: String): Future[ViewResult] = {
Future {
resolveBucket(from).query(q)
}
}
def getWithCas(from: String, id: String): Option[(JsonObject, Long)] = {
try {
val result = resolveBucket(from).get(id, 10, TimeUnit.SECONDS)
if (result != null) {
//log.info (s"${id} loaded from ${from} with cas ${result.cas}")
Some(result.content(), result.cas)
} else {
Some(JsonObject.empty(), 0L)
}
} catch {
case e: Throwable => None
}
}
daschl
June 26, 2015, 10:26am
4
@yadiguzel can you reproduce this in a development environment? It would be interesting to see what the request that it is trying to locate looks like - that would help a lot!