Program: 55647
Project: 55647
Buggy source:
private static final boolean invalidateReceiverLookupCaches(final ExecutionVertex failedVertex,final Set<ExecutionVertex> verticesToBeCanceled){
  final Map<AbstractInstance,Set<ChannelID>> entriesToInvalidate=new HashMap<AbstractInstance,Set<ChannelID>>();
  final ExecutionGraph eg=failedVertex.getExecutionGraph();
  final Environment env=failedVertex.getEnvironment();
  for (int i=0; i < env.getNumberOfOutputGates(); ++i) {
    final OutputGate<? extends Record> outputGate=env.getOutputGate(i);
    for (int j=0; j < outputGate.getNumberOfOutputChannels(); ++j) {
      final AbstractOutputChannel<? extends Record> outputChannel=outputGate.getOutputChannel(j);
      if (outputChannel.getType() == ChannelType.FILE) {
        continue;
      }
      final ExecutionVertex connectedVertex=eg.getVertexByChannelID(outputChannel.getConnectedChannelID());
      if (connectedVertex == null) {
        LOG.error("String_Node_Str");
        continue;
      }
      if (verticesToBeCanceled.contains(connectedVertex)) {
        continue;
      }
      final AbstractInstance instance=connectedVertex.getAllocatedResource().getInstance();
      Set<ChannelID> channelIDs=entriesToInvalidate.get(instance);
      if (channelIDs == null) {
        channelIDs=new SerializableHashSet<ChannelID>();
        entriesToInvalidate.put(instance,channelIDs);
      }
      channelIDs.add(outputChannel.getID());
    }
  }
  for (int i=0; i < env.getNumberOfInputGates(); ++i) {
    final InputGate<? extends Record> inputGate=env.getInputGate(i);
    for (int j=0; j < inputGate.getNumberOfInputChannels(); ++j) {
      final AbstractInputChannel<? extends Record> inputChannel=inputGate.getInputChannel(j);
      if (inputChannel.getType() == ChannelType.FILE) {
        continue;
      }
      final ExecutionVertex connectedVertex=eg.getVertexByChannelID(inputChannel.getConnectedChannelID());
      if (connectedVertex == null) {
        LOG.error("String_Node_Str");
        continue;
      }
      if (verticesToBeCanceled.contains(connectedVertex)) {
        continue;
      }
      final AbstractInstance instance=connectedVertex.getAllocatedResource().getInstance();
      Set<ChannelID> channelIDs=entriesToInvalidate.get(instance);
      if (channelIDs == null) {
        channelIDs=new SerializableHashSet<ChannelID>();
        entriesToInvalidate.put(instance,channelIDs);
      }
      channelIDs.add(inputChannel.getID());
    }
  }
  final Iterator<Map.Entry<AbstractInstance,Set<ChannelID>>> it=entriesToInvalidate.entrySet().iterator();
  while (it.hasNext()) {
    final Map.Entry<AbstractInstance,Set<ChannelID>> entry=it.next();
    final AbstractInstance instance=entry.getKey();
    try {
      instance.invalidateLookupCacheEntries(entry.getValue());
    }
 catch (    IOException ioe) {
      LOG.error(StringUtils.stringifyException(ioe));
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
private static final boolean invalidateReceiverLookupCaches(final ExecutionVertex failedVertex,final Set<ExecutionVertex> verticesToBeCanceled){
  final Map<AbstractInstance,Set<ChannelID>> entriesToInvalidate=new HashMap<AbstractInstance,Set<ChannelID>>();
  final ExecutionGraph eg=failedVertex.getExecutionGraph();
  final Environment env=failedVertex.getEnvironment();
  for (int i=0; i < env.getNumberOfOutputGates(); ++i) {
    final OutputGate<? extends Record> outputGate=env.getOutputGate(i);
    for (int j=0; j < outputGate.getNumberOfOutputChannels(); ++j) {
      final AbstractOutputChannel<? extends Record> outputChannel=outputGate.getOutputChannel(j);
      if (outputChannel.getType() == ChannelType.FILE) {
        continue;
      }
      final ChannelID connectedChannelID=outputChannel.getConnectedChannelID();
      final ExecutionVertex connectedVertex=eg.getVertexByChannelID(connectedChannelID);
      if (connectedVertex == null) {
        LOG.error("String_Node_Str");
        continue;
      }
      if (verticesToBeCanceled.contains(connectedVertex)) {
        continue;
      }
      final AbstractInstance instance=connectedVertex.getAllocatedResource().getInstance();
      Set<ChannelID> channelIDs=entriesToInvalidate.get(instance);
      if (channelIDs == null) {
        channelIDs=new SerializableHashSet<ChannelID>();
        entriesToInvalidate.put(instance,channelIDs);
      }
      channelIDs.add(connectedChannelID);
    }
  }
  for (int i=0; i < env.getNumberOfInputGates(); ++i) {
    final InputGate<? extends Record> inputGate=env.getInputGate(i);
    for (int j=0; j < inputGate.getNumberOfInputChannels(); ++j) {
      final AbstractInputChannel<? extends Record> inputChannel=inputGate.getInputChannel(j);
      if (inputChannel.getType() == ChannelType.FILE) {
        continue;
      }
      final ChannelID connectedChannelID=inputChannel.getConnectedChannelID();
      final ExecutionVertex connectedVertex=eg.getVertexByChannelID(connectedChannelID);
      if (connectedVertex == null) {
        LOG.error("String_Node_Str");
        continue;
      }
      if (verticesToBeCanceled.contains(connectedVertex)) {
        continue;
      }
      final AbstractInstance instance=connectedVertex.getAllocatedResource().getInstance();
      Set<ChannelID> channelIDs=entriesToInvalidate.get(instance);
      if (channelIDs == null) {
        channelIDs=new SerializableHashSet<ChannelID>();
        entriesToInvalidate.put(instance,channelIDs);
      }
      channelIDs.add(connectedChannelID);
    }
  }
  final Iterator<Map.Entry<AbstractInstance,Set<ChannelID>>> it=entriesToInvalidate.entrySet().iterator();
  while (it.hasNext()) {
    final Map.Entry<AbstractInstance,Set<ChannelID>> entry=it.next();
    final AbstractInstance instance=entry.getKey();
    try {
      instance.invalidateLookupCacheEntries(entry.getValue());
    }
 catch (    IOException ioe) {
      LOG.error(StringUtils.stringifyException(ioe));
      return false;
    }
  }
  return true;
}