Error on replacing the database file
thranduil opened this issue · 2 comments
thranduil commented
We use Ip2proxy where we load database using IP2Proxy.IOModes.IP2PROXY_MEMORY_MAPPED mode.
When a background process replaces database file (using cp command) we receive one of the following errors when calling GetProxyType() method.
See stacktrace:
java.lang.InternalError: a fault occurred in a recent unsafe memory access operation in compiled Java code
at com.ip2proxy.IP2Proxy.Read128(IP2Proxy.java:1210)
at com.ip2proxy.IP2Proxy.Read32Or128(IP2Proxy.java:1202)
at com.ip2proxy.IP2Proxy.ProxyQuery(IP2Proxy.java:800)
at com.ip2proxy.IP2Proxy.GetProxyType(IP2Proxy.java:256)
and
java.lang.IllegalArgumentException: newPosition < 0: (-1157713828 < 0)
at java.base/java.nio.Buffer.createPositionException(Buffer.java:341)
at java.base/java.nio.Buffer.position(Buffer.java:316)
at java.base/java.nio.ByteBuffer.position(ByteBuffer.java:1516)
at java.base/java.nio.MappedByteBuffer.position(MappedByteBuffer.java:321)
at java.base/java.nio.MappedByteBuffer.position(MappedByteBuffer.java:73)
at com.ip2proxy.IP2Proxy.ReadStr(IP2Proxy.java:1255)
at com.ip2proxy.IP2Proxy.ProxyQuery(IP2Proxy.java:837)
at com.ip2proxy.IP2Proxy.GetProxyType(IP2Proxy.java:256)
We are running openjdk version "17.0.8.1" 2023-08-24 and Ubuntu 22.04.3 LTS.
Any help would be welcome.
BlackBaroness commented
I think you should close and reopen IP2Proxy instance when replacing the file
ip2location commented
I think you should close and reopen IP2Proxy instance when replacing the file
Yes, that should be the correct way to replace the BIN file.