ArrayIndexOutOfBoundsException 128 on bucket.get(id) call when repeatedly serializing to a byte array

java

#1

Getting following exception on bucket.get(id) using couchbase server 4.5 .

Could not decode document with ID Category::557
java.lang.ArrayIndexOutOfBoundsException: 128 
at com.couchbase.client.deps.com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer.addName(ByteQuadsCanonicalizer.java:853)
at com.couchbase.client.deps.com.fasterxml.jackson.core.json.UTF8StreamJsonParser.addName(UTF8StreamJsonParser.java:2340)
at com.couchbase.client.deps.com.fasterxml.jackson.core.json.UTF8StreamJsonParser.findName(UTF8StreamJsonParser.java:2185)
at com.couchbase.client.deps.com.fasterxml.jackson.core.json.UTF8StreamJsonParser._parseName(UTF8StreamJsonParser.java:1686)
at com.couchbase.client.deps.com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:740)
at com.couchbase.client.java.transcoder.JacksonTransformers$AbstractJsonValueDeserializer.decodeObject(JacksonTransformers.java:75)
at com.couchbase.client.java.transcoder.JacksonTransformers$AbstractJsonValueDeserializer.decodeObject(JacksonTransformers.java:47)
at com.couchbase.client.java.transcoder.JacksonTransformers$JsonObjectDeserializer.deserialize(JacksonTransformers.java:134)
at com.couchbase.client.java.transcoder.JacksonTransformers$JsonObjectDeserializer.deserialize(JacksonTransformers.java:129)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3702)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2817)
at com.couchbase.client.java.transcoder.JsonTranscoder.byteBufToClass(JsonTranscoder.java:107)
at com.couchbase.client.java.transcoder.JsonTranscoder.byteBufToJsonObject(JsonTranscoder.java:118)
at com.couchbase.client.java.transcoder.JsonTranscoder.doDecode(JsonTranscoder.java:70)
at com.couchbase.client.java.transcoder.JsonTranscoder.doDecode(JsonTranscoder.java:46)
at com.couchbase.client.java.transcoder.AbstractTranscoder.decode(AbstractTranscoder.java:47)
at com.couchbase.client.java.CouchbaseAsyncBucket$1.call(CouchbaseAsyncBucket.java:235)
at com.couchbase.client.java.CouchbaseAsyncBucket$1.call(CouchbaseAsyncBucket.java:231)
at rx.internal.operators.OperatorMap$1.onNext(OperatorMap.java:55)
at rx.internal.operators.OperatorFilter$1.onNext(OperatorFilter.java:54)
at rx.observers.Subscribers$5.onNext(Subscribers.java:234)
at rx.subjects.SubjectSubscriptionManager$SubjectObserver.onNext(SubjectSubscriptionManager.java:224)
at rx.subjects.AsyncSubject.onCompleted(AsyncSubject.java:101)
at com.couchbase.client.core.endpoint.AbstractGenericHandler$1.call(AbstractGenericHandler.java:256)
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.kv.GetResponse.class
at rx.exceptions.OnErrorThrowable.addValueAsLastCause(OnErrorThrowable.java:104)
at rx.internal.operators.OperatorMap$1.onNext(OperatorMap.java:58)... 13 more

As per the link https://github.com/FasterXML/jackson-core/issues/216, there is some issue with the jackson mapper being used by couchbase internally and can’t be handled on my side.
Is there any workaround available for this issue.


#2

@ibuser which Java SDK version are you using? We have updated Jackson internally quite a few times and also because of this bug, so if you pick a recent SDK version you won’t hit this bug. Try going to 2.3.1 or 2.2.8.


#3

Upgraded to 2.3.1 working fine now. Thanks :slight_smile: