java.lang.ArrayIndexOutOfBoundsException: 70331
at com.aerospike.client.command.Buffer.stringToUtf8(Buffer.java:186)
~[aerospike-client-3.0.31.jar:na]
at com.aerospike.client.Value$StringValue.write(Value.java:352) ~[aerospike-client-3.0.31.jar:na]
at com.aerospike.client.command.Command.writeOperation(Command.java:524)
~[aerospike-client-3.0.31.jar:na]
at com.aerospike.client.command.Command.setWrite(Command.java:83) ~[aerospike-client-3.0.31.jar:na]
at com.aerospike.client.command.WriteCommand.writeBuffer(WriteCommand.java:49)
~[aerospike-client-3.0.31.jar:na]
at com.aerospike.client.command.SyncCommand.execute(SyncCommand.java:47)
~[aerospike-client-3.0.31.jar:na]
at com.aerospike.client.AerospikeClient.put(AerospikeClient.java:295)
~[aerospike-client-3.0.31.jar:na]
We have not reached that limit for sure. Its not related to unique binNames as we handled that case separately.
Also I have tested that limit and the error message is not this.
This may have to to do with the amount of data being pushed in bins.
I am inserting about 20 unique bins (all less than 13 characters)
Here is the code snippet :
final Bin[] bins = new Bin[row.size()];//row is --> Map<String, Object> row
int i = 0;
for (Map.Entry<String, Object> entry : row.entrySet()) {
String column = entry.getKey();
bins[i++] = new Bin(column, (String) entry.getValue());
}
client.put(writePolicy, k, bins); // WritePolicy writePolicy = new WritePolicy();
While debugging I found that in this loop in Command class Line:83 (aerospike-client-3.0.31)
for (Bin bin : bins) {
writeOperation(bin, operation);
}
its able to process few bins and then AIOBE is thrown.
If the buffer size is not calculated correctly and the size is greater than the default buffer size (8K), then you will get a buffer overflow. I suspect “Buffer.estimateSizeUtf8()” may be calculating a different size than is actually written, but it could be other estimations as well.
Is it possible to provide a small sample program that reproduces the problem?
Most strings will be calculated correctly, but I’m not sure about some multi-byte UTF8 characters.
We’re also getting the same error with client version 3.0.33.
client.put(asWritePolicy, new Key("main", "test1", keyValue), new Bin("data", data), new Bin("schema", "1"))
where keyValue is a 36 length string and data is a byte array of length 8208. Write policy has sendkey = true as well.
Update:
After a little more testing. It seems that the issue doesn’t occur if we disable sendkey. For now, I’m adding the key to a bin, but this still seems like an issue that should get resolved.
Thanks for the sample code. The “sendkey=true” was the crucial piece as that code had a bug in it. The fix will be in the next java client release.
@ayush , thanks !
I too found out about sendkey feature causing this issue and have disabled it for now.
Also, @helipilot50 suggested to use extra bin to store user key data in this post .