Program: 91416
Project: 91416
Buggy source:
/** 
 * called from a remote node as part of replication
 * @param keyBytes
 * @param value
 * @param hash2
 * @param identifier
 * @param timestamp
 * @param valueLen
 * @param entrySize1
 * @return
 */
private void replicatingPut(Bytes keyBytes,Bytes value,int hash2,final byte identifier,final long timestamp,final long valueLen,final long entrySize1){
  lock();
  try {
    long keyLen=keyBytes.remaining();
    hashLookupLiveAndDeleted.startSearch(hash2);
    int pos;
    while ((pos=hashLookupLiveAndDeleted.nextPos()) >= 0) {
      long offset=offsetFromPos(pos);
      NativeBytes entry=entry(offset);
      if (!keyEquals(keyBytes,keyLen,entry))       continue;
      entry.skip(keyLen);
      boolean wasDeleted;
      final long timeStampPos=entry.positionAddr();
      if (shouldTerminate(entry,timestamp,identifier))       return;
      wasDeleted=entry.readBoolean();
      entry.positionAddr(timeStampPos);
      entry.writeLong(timestamp);
      entry.writeByte(identifier);
      entry.writeBoolean(false);
{
        long valueLenPos=entry.position();
        long entryEndAddr=entry.positionAddr() + valueLen;
        putValue(pos,offset,entry,valueLenPos,entryEndAddr,value);
      }
      if (wasDeleted) {
        hashLookupLiveOnly.put(hash2,pos);
        incrementSize();
      }
      return;
    }
    pos=alloc(inBlocks(entrySize1));
    long offset=offsetFromPos(pos);
    clearMetaData(offset);
    NativeBytes entry=entry(offset);
    entry.writeStopBit(keyLen);
    entry.write(keyBytes);
    entry.writeLong(timestamp);
    entry.writeByte(identifier);
    entry.writeBoolean(false);
    entry.writeStopBit(valueLen);
    alignment.alignPositionAddr(entry);
    entry.write(value);
    hashLookupLiveAndDeleted.putAfterFailedSearch(pos);
    hashLookupLiveOnly.put(hash2,pos);
    incrementSize();
  }
  finally {
    unlock();
  }
}

Fixed version (ground truth):
/** 
 * called from a remote node as part of replication
 * @param keyBytes
 * @param valueBytes
 * @param hash2
 * @param identifier
 * @param timestamp
 * @return
 */
private void replicatingPut(Bytes keyBytes,Bytes valueBytes,int hash2,final byte identifier,final long timestamp){
  lock();
  try {
    long keyLen=keyBytes.remaining();
    hashLookupLiveAndDeleted.startSearch(hash2);
    for (int pos; (pos=hashLookupLiveAndDeleted.nextPos()) >= 0; ) {
      long offset=offsetFromPos(pos);
      NativeBytes entry=entry(offset);
      if (!keyEquals(keyBytes,keyLen,entry))       continue;
      entry.skip(keyLen);
      final long timeStampPos=entry.positionAddr();
      if (shouldTerminate(entry,timestamp,identifier))       return;
      boolean wasDeleted=entry.readBoolean();
      entry.positionAddr(timeStampPos);
      entry.writeLong(timestamp);
      entry.writeByte(identifier);
      entry.writeBoolean(false);
      long valueLenPos=entry.position();
      long valueLen=readValueLen(entry);
      long entryEndAddr=entry.positionAddr() + valueLen;
      putValue(pos,offset,entry,valueLenPos,entryEndAddr,valueBytes);
      if (wasDeleted) {
        hashLookupLiveOnly.put(hash2,pos);
        incrementSize();
      }
      return;
    }
    long valueLen=valueBytes.remaining();
    int pos=alloc(inBlocks(entrySize(keyLen,valueLen)));
    long offset=offsetFromPos(pos);
    clearMetaData(offset);
    NativeBytes entry=entry(offset);
    entry.writeStopBit(keyLen);
    entry.write(keyBytes);
    entry.writeLong(timestamp);
    entry.writeByte(identifier);
    entry.writeBoolean(false);
    entry.writeStopBit(valueLen);
    alignment.alignPositionAddr(entry);
    entry.write(valueBytes);
    hashLookupLiveAndDeleted.putAfterFailedSearch(pos);
    hashLookupLiveOnly.put(hash2,pos);
    incrementSize();
  }
  finally {
    unlock();
  }
}