Program: 87244
Project: 87244
Buggy source:
public void messageReceived(Transport.Packet aPacket){
  if ((_common.testState(Common.FSMStates.OUT_OF_DATE)) || (_common.testState(Common.FSMStates.SHUTDOWN)))   return;
  PaxosMessage myMessage=aPacket.getMessage();
  long mySeqNum=myMessage.getSeqNum();
  Writer myWriter=new LiveWriter();
  if (_common.testState(Common.FSMStates.RECOVERING)) {
switch (myMessage.getType()) {
case Operations.NEED:
      return;
case Operations.OUTOFDATE:
{
synchronized (this) {
        completedRecovery();
        _common.setState(Common.FSMStates.OUT_OF_DATE);
      }
      _common.signal(new VoteOutcome(VoteOutcome.Reason.OUT_OF_DATE,mySeqNum,_common.getLeaderRndNum(),new Proposal(),aPacket.getSource()));
      return;
    }
}
}
boolean myRecoveryInProgress=_common.testState(Common.FSMStates.RECOVERING);
Need myWindow=_common.getRecoveryTrigger().shouldRecover(myMessage.getSeqNum(),_localAddress);
int mySeqNumPosition=(myRecoveryInProgress) ? _recoveryWindow.get().relativeToWindow(mySeqNum) : Integer.MIN_VALUE;
Sender mySender=(myRecoveryInProgress) ? new RecoverySender() : new LiveSender();
if ((!myRecoveryInProgress) && (myWindow != null)) {
synchronized (this) {
  _packetBuffer.clear();
  try {
    _packetBuffer.put(aPacket);
  }
 catch (  InterruptedException anIE) {
    _logger.error("String_Node_Str",anIE);
    throw new RuntimeException("String_Node_Str",anIE);
  }
  mySender.send(myWindow,_common.getFD().getRandomMember(_localAddress));
  _common.setState(Common.FSMStates.RECOVERING);
  _recoveryWindow.set(myWindow);
  reschedule();
}
}
if ((myRecoveryInProgress) && (mySeqNumPosition == 1)) {
try {
  _packetBuffer.put(aPacket);
}
 catch (InterruptedException anIE) {
  _logger.error("String_Node_Str",anIE);
  throw new RuntimeException("String_Node_Str",anIE);
}
}
if (((myRecoveryInProgress) && (mySeqNumPosition == 0)) || ((!myRecoveryInProgress) && (myWindow == null))) {
process(aPacket,myWriter,mySender);
if (myRecoveryInProgress) {
  if (_common.getRecoveryTrigger().getLowWatermark().getSeqNum() == _recoveryWindow.get().getMaxSeq()) {
synchronized (this) {
      for (      Transport.Packet myReplayPacket : _packetBuffer) {
        if (_common.getRecoveryTrigger().shouldRecover(myReplayPacket.getMessage().getSeqNum(),_localAddress) != null)         break;
        process(myReplayPacket,myWriter,mySender);
      }
      completedRecovery();
      _common.testAndSetState(Common.FSMStates.RECOVERING,Common.FSMStates.ACTIVE);
    }
  }
}
}
}

Fixed version (ground truth):
public void messageReceived(Transport.Packet aPacket){
  if ((_common.testState(Common.FSMStates.OUT_OF_DATE)) || (_common.testState(Common.FSMStates.SHUTDOWN)))   return;
  PaxosMessage myMessage=aPacket.getMessage();
  long mySeqNum=myMessage.getSeqNum();
  Writer myWriter=new LiveWriter();
  if (_common.testState(Common.FSMStates.RECOVERING)) {
switch (myMessage.getType()) {
case Operations.NEED:
      return;
case Operations.OUTOFDATE:
{
synchronized (this) {
        completedRecovery();
        _common.setState(Common.FSMStates.OUT_OF_DATE);
      }
      _common.signal(new VoteOutcome(VoteOutcome.Reason.OUT_OF_DATE,mySeqNum,_common.getLeaderRndNum(),new Proposal(),aPacket.getSource()));
      return;
    }
}
}
boolean myRecoveryInProgress=_common.testState(Common.FSMStates.RECOVERING);
Need myWindow=_common.getRecoveryTrigger().shouldRecover(myMessage.getSeqNum(),_localAddress);
int mySeqNumPosition=(myRecoveryInProgress) ? _recoveryWindow.get().relativeToWindow(mySeqNum) : Integer.MIN_VALUE;
Sender mySender=(myRecoveryInProgress) ? new RecoverySender() : new LiveSender();
boolean myMisfire=false;
if ((!myRecoveryInProgress) && (myWindow != null)) {
boolean madeRecoveryTransition=false;
synchronized (_packetBuffer) {
  madeRecoveryTransition=_common.testAndSetState(Common.FSMStates.ACTIVE,Common.FSMStates.RECOVERING);
  if (madeRecoveryTransition) {
    _packetBuffer.clear();
    try {
      _packetBuffer.put(aPacket);
    }
 catch (    InterruptedException anIE) {
      _logger.error("String_Node_Str",anIE);
      throw new RuntimeException("String_Node_Str",anIE);
    }
    _recoveryWindow.set(myWindow);
  }
}
if (madeRecoveryTransition) {
  mySender.send(myWindow,_common.getFD().getRandomMember(_localAddress));
  reschedule();
}
 else {
  myMisfire=true;
}
}
if ((myRecoveryInProgress) && (mySeqNumPosition == 1)) {
synchronized (_packetBuffer) {
  if (_common.testState(Common.FSMStates.RECOVERING)) {
    try {
      _packetBuffer.put(aPacket);
    }
 catch (    InterruptedException anIE) {
      _logger.error("String_Node_Str",anIE);
      throw new RuntimeException("String_Node_Str",anIE);
    }
  }
 else {
    myMisfire=true;
  }
}
}
if (((myRecoveryInProgress) && (mySeqNumPosition == 0)) || ((!myRecoveryInProgress) && (myWindow == null))) {
process(aPacket,myWriter,mySender);
if (myRecoveryInProgress) {
  if (_common.getRecoveryTrigger().getLowWatermark().getSeqNum() == _recoveryWindow.get().getMaxSeq()) {
synchronized (_packetBuffer) {
      if (_common.testState(Common.FSMStates.RECOVERING)) {
        for (        Transport.Packet myReplayPacket : _packetBuffer) {
          if (_common.getRecoveryTrigger().shouldRecover(myReplayPacket.getMessage().getSeqNum(),_localAddress) != null)           break;
          process(myReplayPacket,myWriter,mySender);
        }
        completedRecovery();
        _common.testAndSetState(Common.FSMStates.RECOVERING,Common.FSMStates.ACTIVE);
      }
 else {
        myMisfire=true;
      }
    }
  }
}
}
if (myMisfire) messageReceived(aPacket);
}