-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ArrayIndexOutOfBoundsException in tryCity method from maxmind #68
Comments
It sounds like your database is corrupt. |
But I works successfully for about 12K requests by minute in PRODUCTION, and generates only for about 50 errors in 1 minute, why do you say it sounds like it is corrupted? |
The fact that it is intermittent supports the idea that it is corrupted. Although the error handling could be improved in this case to throw a nicer exception, what is happening is that it is hitting an unknown and invalid data type in the file while decoding a record. Are you storing the database in a JAR file? If so, please ensure you have binary filtering disabled. |
I got it, right now we are storing this maxmind database in a shared volume in kubernetes and not inside a JAR file. Yeah, I agree that if the maxmind lib could throw a checked exception it'll be better to us to catch it in the correct way. Well for now, until a possible improvement, we are going to catch the "runtime exception" in our code, thank you very much! |
@oschwald I have a doubt, is going to be created any task to improve this exception treatment? |
Yes, we plan on improving the exception to throw an |
If the files are not replaced atomically on update, you would very likely see errors such as this as well as various |
@oschwald yeah, the files are replaced atomically. we reproduced the error in local environment, how to reproduce:
In our system, we were using the MaxMind read option: MEMORY_MAP (https://github.com/maxmind/MaxMind-DB-Reader-java#usage) ... after change it to MEMORY option, we couldn't reproduce again this error in our local environment. |
Can you share the exact mechanism used for (3) and the OS and file system? |
Previously, we would throw an ArrayIndexOutOfBoundsException. Closes #68.
The exact mechanism used in (3) is: We used JMeter to make a GET request to one fixed endpoint that uses MaxMind (using SpringBoot and Java Amazon Corretto 11), we configured JMeter to create 100 threads, making an interval of 5 seconds to wait and repeat it 3 times. The all process takes for about 15 seconds. During this 15 seconds of execution, we replaced between the old and new MaxMind databases (using the terminal we made a cp -r /tmp/oldMaxmind/ /project/maxmind-files/ and then a cp -r /tmp/newMaxmind/ /project/maxmind-files/ at least 6 times) My notebook is an Ubuntu 19: Thank you! |
|
Dear maxmind developers,
We are using the last lib
From time to time we observed some errors from maxmind lib, you can see the stacktrace below:
"stack_trace":"java.lang.ArrayIndexOutOfBoundsException: Index 34 out of bounds for length 16\n\tat com.maxmind.db.Decoder$Type.get(Decoder.java:53)\n\tat com.maxmind.db.Decoder.decode(Decoder.java:129)\n\tat com.maxmind.db.Decoder.decode(Decoder.java:88)\n\tat com.maxmind.db.Reader.resolveDataPointer(Reader.java:256)\n\tat com.maxmind.db.Reader.getRecord(Reader.java:176)\n\tat com.maxmind.geoip2.DatabaseReader.get(DatabaseReader.java:271)\n\tat com.maxmind.geoip2.DatabaseReader.tryCity(DatabaseReader.java:334)
As we analysed the code, the error starts in Decoder.class, specifically in this part:
static enum Type {
EXTENDED,
POINTER,
UTF8_STRING,
DOUBLE,
BYTES,
UINT16,
UINT32,
MAP,
INT32,
UINT64,
UINT128,
ARRAY,
CONTAINER,
END_MARKER,
BOOLEAN,
FLOAT;
sometimes the i parameter is 36, but there are only 16 fixed values in the ENUM.
Thanks
The text was updated successfully, but these errors were encountered: