Program: 87264
Project: 87264
Buggy source:
/** 
 * Do actions for the state we are now in.  Essentially, we're always one state ahead of the participants thus we process the result of a Collect in the BEGIN state which means we expect Last or OldRound and in SUCCESS state we expect ACCEPT or OLDROUND
 */
private void process(){
switch (_stage) {
case ABORT:
case EXIT:
{
      _logger.info("String_Node_Str" + _completion);
      if (_membership != null)       _membership.dispose();
      if (_stage != EXIT) {
        _al.signal(_completion);
      }
      return;
    }
case SUBMITTED:
{
    _membership=_detector.getMembers(this);
    _logger.info("String_Node_Str" + Long.toHexString(_seqNum) + "String_Node_Str"+ _membership.getSize()+ "String_Node_Str");
    _stage=COLLECT;
    process();
    break;
  }
case COLLECT:
{
  if ((!isLeader()) && (!isRecovery())) {
    Collect myLastCollect=_al.getLastCollect();
    if (!myLastCollect.isInitial()) {
      NodeId myOtherLeader=NodeId.from(myLastCollect.getNodeId());
      if (_detector.isLive(myOtherLeader)) {
        error(Reasons.OTHER_LEADER,myOtherLeader);
      }
    }
    updateRndNumber(myLastCollect.getRndNumber());
    _seqNum=_al.getLowWatermark();
    if (_seqNum == LogStorage.EMPTY_LOG)     _seqNum=0;
    _stage=RECOVER;
    emitCollect();
  }
 else   if (isRecovery()) {
    ++_seqNum;
    if (_seqNum > _highWatermark) {
      notRecovery();
      amLeader();
      _logger.info("String_Node_Str");
      _value=_clientOp.getConsolidatedValue();
      _stage=BEGIN;
      process();
    }
 else {
      _value=LogStorage.NO_VALUE;
      _stage=BEGIN;
      emitCollect();
    }
  }
 else   if (isLeader()) {
    _logger.info("String_Node_Str");
    _value=_clientOp.getConsolidatedValue();
    ++_seqNum;
    _stage=BEGIN;
    process();
  }
  break;
}
case RECOVER:
{
long myMinSeq=-1;
long myMaxSeq=-1;
Iterator<PaxosMessage> myMessages=_messages.iterator();
while (myMessages.hasNext()) {
  PaxosMessage myMessage=myMessages.next();
  if (myMessage.getType() == Operations.OLDROUND) {
    oldRound(myMessage);
    return;
  }
 else {
    Last myLast=(Last)myMessage;
    long myLow=myLast.getLowWatermark();
    long myHigh=myLast.getHighWatermark();
    if (myLow != LogStorage.EMPTY_LOG) {
      if (myLow < myMinSeq)       myMinSeq=myLow;
    }
    if (myHigh != LogStorage.EMPTY_LOG) {
      if (myHigh > myMaxSeq) {
        myMaxSeq=myHigh;
      }
    }
  }
}
amRecovery();
_lowWatermark=myMinSeq;
_highWatermark=myMaxSeq;
if (_lowWatermark == -1) _seqNum=-1;
 else _seqNum=_lowWatermark - 1;
_logger.info("String_Node_Str" + _lowWatermark + "String_Node_Str"+ _highWatermark+ "String_Node_Str"+ _seqNum+ "String_Node_Str");
_stage=COLLECT;
process();
break;
}
case BEGIN:
{
byte[] myValue=_value;
if (!isLeader()) {
long myMaxRound=0;
Iterator<PaxosMessage> myMessages=_messages.iterator();
while (myMessages.hasNext()) {
  PaxosMessage myMessage=myMessages.next();
  if (myMessage.getType() == Operations.OLDROUND) {
    oldRound(myMessage);
    return;
  }
 else {
    Last myLast=(Last)myMessage;
    if (myLast.getRndNumber() > myMaxRound) {
      myMaxRound=myLast.getRndNumber();
      myValue=myLast.getValue();
    }
  }
}
}
_value=myValue;
emitBegin();
_stage=SUCCESS;
break;
}
case SUCCESS:
{
int myAcceptCount=0;
Iterator<PaxosMessage> myMessages=_messages.iterator();
while (myMessages.hasNext()) {
PaxosMessage myMessage=myMessages.next();
if (myMessage.getType() == Operations.OLDROUND) {
oldRound(myMessage);
return;
}
 else {
myAcceptCount++;
}
}
if (myAcceptCount >= _membership.getMajority()) {
emitSuccess();
_stage=COMMITTED;
}
 else {
emitBegin();
_stage=SUCCESS;
}
break;
}
case COMMITTED:
{
if (_messages.size() >= _membership.getMajority()) {
successful(Reasons.OK,null);
}
 else {
emitSuccess();
_stage=COMMITTED;
}
break;
}
default :
throw new RuntimeException("String_Node_Str" + _stage);
}
}

Fixed version (ground truth):
/** 
 * Do actions for the state we are now in.  Essentially, we're always one state ahead of the participants thus we process the result of a Collect in the BEGIN state which means we expect Last or OldRound and in SUCCESS state we expect ACCEPT or OLDROUND
 */
private void process(){
switch (_stage) {
case ABORT:
{
      _logger.info("String_Node_Str" + _completion);
      if (_membership != null)       _membership.dispose();
      _al.signal(_completion);
      return;
    }
case EXIT:
{
    _logger.info("String_Node_Str" + _completion);
    if (_membership != null)     _membership.dispose();
    if (isRecovery()) {
      _stage=SUBMITTED;
      process();
    }
 else {
      _heartbeatAlarm=new HeartbeatTask();
      _watchdog.schedule(_heartbeatAlarm,calculateLeaderRefresh());
    }
    return;
  }
case SUBMITTED:
{
  _membership=_detector.getMembers(this);
  _logger.info("String_Node_Str" + Long.toHexString(_seqNum) + "String_Node_Str"+ _membership.getSize()+ "String_Node_Str");
  _stage=COLLECT;
  process();
  break;
}
case COLLECT:
{
if ((!isLeader()) && (!isRecovery())) {
  _logger.info("String_Node_Str");
  Collect myLastCollect=_al.getLastCollect();
  if (!myLastCollect.isInitial()) {
    NodeId myOtherLeader=NodeId.from(myLastCollect.getNodeId());
    if (_detector.isLive(myOtherLeader)) {
      error(Reasons.OTHER_LEADER,myOtherLeader);
    }
  }
  _logger.info("String_Node_Str");
  updateRndNumber(myLastCollect.getRndNumber());
  _seqNum=_al.getLowWatermark();
  if (_seqNum == LogStorage.EMPTY_LOG)   _seqNum=0;
  _stage=RECOVER;
  emitCollect();
}
 else if (isRecovery()) {
  ++_seqNum;
  if (_seqNum > _highWatermark) {
    notRecovery();
    amLeader();
    _logger.info("String_Node_Str");
    _value=_clientOp.getConsolidatedValue();
    _stage=BEGIN;
    process();
  }
 else {
    _value=LogStorage.NO_VALUE;
    _stage=BEGIN;
    emitCollect();
  }
}
 else if (isLeader()) {
  _logger.info("String_Node_Str");
  _value=_clientOp.getConsolidatedValue();
  ++_seqNum;
  _stage=BEGIN;
  process();
}
break;
}
case RECOVER:
{
long myMinSeq=-1;
long myMaxSeq=-1;
Iterator<PaxosMessage> myMessages=_messages.iterator();
while (myMessages.hasNext()) {
PaxosMessage myMessage=myMessages.next();
if (myMessage.getType() == Operations.OLDROUND) {
  oldRound(myMessage);
  return;
}
 else {
  Last myLast=(Last)myMessage;
  long myLow=myLast.getLowWatermark();
  long myHigh=myLast.getHighWatermark();
  if (myLow != LogStorage.EMPTY_LOG) {
    if (myLow < myMinSeq)     myMinSeq=myLow;
  }
  if (myHigh != LogStorage.EMPTY_LOG) {
    if (myHigh > myMaxSeq) {
      myMaxSeq=myHigh;
    }
  }
}
}
amRecovery();
_lowWatermark=myMinSeq;
_highWatermark=myMaxSeq;
if (_lowWatermark == -1) _seqNum=-1;
 else _seqNum=_lowWatermark - 1;
_logger.info("String_Node_Str" + _lowWatermark + "String_Node_Str"+ _highWatermark+ "String_Node_Str"+ _seqNum+ "String_Node_Str");
_stage=COLLECT;
process();
break;
}
case BEGIN:
{
byte[] myValue=_value;
if (!isLeader()) {
long myMaxRound=0;
Iterator<PaxosMessage> myMessages=_messages.iterator();
while (myMessages.hasNext()) {
PaxosMessage myMessage=myMessages.next();
if (myMessage.getType() == Operations.OLDROUND) {
  oldRound(myMessage);
  return;
}
 else {
  Last myLast=(Last)myMessage;
  if (myLast.getRndNumber() > myMaxRound) {
    myMaxRound=myLast.getRndNumber();
    myValue=myLast.getValue();
  }
}
}
}
_value=myValue;
emitBegin();
_stage=SUCCESS;
break;
}
case SUCCESS:
{
int myAcceptCount=0;
Iterator<PaxosMessage> myMessages=_messages.iterator();
while (myMessages.hasNext()) {
PaxosMessage myMessage=myMessages.next();
if (myMessage.getType() == Operations.OLDROUND) {
oldRound(myMessage);
return;
}
 else {
myAcceptCount++;
}
}
if (myAcceptCount >= _membership.getMajority()) {
emitSuccess();
_stage=COMMITTED;
}
 else {
emitBegin();
_stage=SUCCESS;
}
break;
}
case COMMITTED:
{
if (_messages.size() >= _membership.getMajority()) {
successful(Reasons.OK,null);
}
 else {
emitSuccess();
_stage=COMMITTED;
}
break;
}
default :
throw new RuntimeException("String_Node_Str" + _stage);
}
}