Program: 93032
Project: 93032
Buggy source:
public void processReceivedMessages(List<com.google.pubsub.v1.ReceivedMessage> responseMessages){
  int receivedMessagesCount=responseMessages.size();
  if (receivedMessagesCount == 0) {
    return;
  }
  Instant now=new Instant(clock.millisTime());
  int totalByteCount=0;
  final ArrayList<AckHandler> ackHandlers=new ArrayList<>(responseMessages.size());
  for (  ReceivedMessage pubsubMessage : responseMessages) {
    int messageSize=pubsubMessage.getMessage().getSerializedSize();
    totalByteCount+=messageSize;
    ackHandlers.add(new AckHandler(pubsubMessage.getAckId(),messageSize));
  }
  Instant expiration=now.plus(messageDeadlineSeconds * 1000);
  logger.log(Level.FINER,"String_Node_Str",new Object[]{responseMessages.size(),now});
  messagesWaiter.incrementPendingMessages(responseMessages.size());
  Iterator<AckHandler> acksIterator=ackHandlers.iterator();
  for (  ReceivedMessage userMessage : responseMessages) {
    final PubsubMessage message=userMessage.getMessage();
    final AckHandler ackHandler=acksIterator.next();
    final SettableFuture<AckReply> response=SettableFuture.create();
    final AckReplyConsumer consumer=new AckReplyConsumer(){
      @Override public void ack(){
        response.set(AckReply.ACK);
      }
      @Override public void nack(){
        response.set(AckReply.NACK);
      }
    }
;
    Futures.addCallback(response,ackHandler);
    executor.submit(new Runnable(){
      @Override public void run(){
        try {
          receiver.receiveMessage(message,consumer);
        }
 catch (        Exception e) {
          response.setException(e);
        }
      }
    }
);
  }
synchronized (outstandingAckHandlers) {
    outstandingAckHandlers.add(new ExtensionJob(new Instant(clock.millisTime()),expiration,INITIAL_ACK_DEADLINE_EXTENSION_SECONDS,ackHandlers));
  }
  setupNextAckDeadlineExtensionAlarm(expiration);
  try {
    flowController.reserve(receivedMessagesCount,totalByteCount);
  }
 catch (  FlowController.FlowControlException unexpectedException) {
    throw new IllegalStateException("String_Node_Str",unexpectedException);
  }
}

Fixed version (ground truth):
public void processReceivedMessages(List<ReceivedMessage> messages,Runnable doneCallback){
  if (messages.isEmpty()) {
    doneCallback.run();
    return;
  }
  messagesWaiter.incrementPendingMessages(messages.size());
  OutstandingMessagesBatch outstandingBatch=new OutstandingMessagesBatch(doneCallback);
  final ArrayList<AckHandler> ackHandlers=new ArrayList<>(messages.size());
  for (  ReceivedMessage message : messages) {
    AckHandler ackHandler=new AckHandler(message.getAckId(),message.getMessage().getSerializedSize());
    ackHandlers.add(ackHandler);
    outstandingBatch.addMessage(message,ackHandler);
  }
  Instant expiration=new Instant(clock.millisTime()).plus(messageDeadlineSeconds * 1000);
synchronized (outstandingAckHandlers) {
    outstandingAckHandlers.add(new ExtensionJob(new Instant(clock.millisTime()),expiration,INITIAL_ACK_DEADLINE_EXTENSION_SECONDS,ackHandlers));
  }
  setupNextAckDeadlineExtensionAlarm(expiration);
synchronized (outstandingMessageBatches) {
    outstandingMessageBatches.add(outstandingBatch);
  }
  processOutstandingBatches();
}