From the core created I could see that
> A fatal error has been detected by the Java Runtime Environment:
> #
> # SIGSEGV (0xb) at pc=0x00007ffbccaa1b83, pid=1781, tid=0x00007ffbb31ec700
> #
> # JRE version: Java(TM) SE Runtime Environment (8.0_181-b25) (build 1.8.0_181-b25)
> # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.181-b25 mixed mode linux-amd64 compressed oops)
> # Problematic frame:
> # J 6754 C2 java.util.Arrays.equals([B[B)Z (54 bytes) @ 0x00007ffbccaa1b83 [0x00007ffbccaa1b60+0x23]
The code were the crash happened is
private List<UnitInfo> unitInfoList = new ArrayList<UnitInfo>();
private final ReentrantReadWriteLock readWriteLock = new ReentrantReadWriteLock();
private final Lock readLock = readWriteLock.readLock();
public UnitInfo getUnitInfoFromIPAddress( InetSocketAddress address )//
{
byte[] ipAddress = address.getAddress().getAddress();
readLock.lock();
try
{
UnitInfo unitInfo;
Iterator<UnitInfo> list = unitInfoList.iterator();
while( list.hasNext() )
{
unitInfo = list.next();
if( null != unitInfo.getIpAddress() )
{
if( Arrays.equals( ipAddress, unitInfo.getIpAddress().getAddress() ) )
{
return unitInfo;
}
}
}
return null;
}
finally
{
//Unlock after completing the read operation.
readLock.unlock();
}
}
Inside the crashed process logs I found many exceptions
Stack Trace Below: null java.lang.NullPointerException at java.util.Arrays.copyOf(Arrays.java:3237) at common.IpAddress.getAddress(IpAddress.java:161)
Those exceptions appeared in many Threads a little time before and stopped when the process was killed.
public byte[] getAddress()
{
byte[] address = null;
if( IPV4_VAL == version )
{
address = Arrays.copyOf(this.address, IPV4_ADDRSIZE);
}
else
{
address = this.address;
}
return address;
}
Obviously those NullPointers were caused because the byte[] this.address was not initialized and it happened that at the time of execution it was still null. The error happened only once so I am wandering what caused the crash to happen inside Arrays.equals()? This method does not fail if a parameter is null. So was it because of another NullPointer inside copyOf() ? In that case wouldn't I see the the copyOf() in the stack trace of the hss_err file? Could it be a concurrency issue with the Iterator and my readlock?