Program: 55635
Project: 55635
Buggy source:
/** 
 * Unregisters the given task from the byte buffered channel manager.
 * @param vertexID the ID of the task to be unregistered
 * @param task the task to be unregistered
 */
public void unregister(final ExecutionVertexID vertexID,final Task task){
  final Environment environment=task.getEnvironment();
  this.recentlyRemovedChannelIDSet.add(environment);
  Iterator<ChannelID> channelIterator=environment.getOutputChannelIDs().iterator();
  while (channelIterator.hasNext()) {
    final ChannelID outputChannelID=channelIterator.next();
    final ChannelContext context=this.registeredChannels.remove(outputChannelID);
    if (context != null) {
      context.destroy();
    }
    this.receiverCache.remove(outputChannelID);
  }
  channelIterator=environment.getInputChannelIDs().iterator();
  while (channelIterator.hasNext()) {
    final ChannelID outputChannelID=channelIterator.next();
    final ChannelContext context=this.registeredChannels.remove(outputChannelID);
    if (context != null) {
      context.destroy();
    }
    this.receiverCache.remove(outputChannelID);
  }
  final Iterator<GateID> inputGateIterator=environment.getInputGateIDs().iterator();
  while (inputGateIterator.hasNext()) {
    final GateID inputGateID=inputGateIterator.next();
    final LocalBufferPoolOwner owner=this.localBufferPoolOwner.remove(inputGateID);
    if (owner != null) {
      owner.clearLocalBufferPool();
    }
  }
  final LocalBufferPoolOwner owner=this.localBufferPoolOwner.remove(vertexID);
  if (owner != null) {
    owner.clearLocalBufferPool();
  }
  redistributeGlobalBuffers();
}

Fixed version (ground truth):
/** 
 * Unregisters the given task from the byte buffered channel manager.
 * @param vertexID the ID of the task to be unregistered
 * @param task the task to be unregistered
 */
public void unregister(final ExecutionVertexID vertexID,final Task task){
  final Environment environment=task.getEnvironment();
  Iterator<ChannelID> channelIterator=environment.getOutputChannelIDs().iterator();
  while (channelIterator.hasNext()) {
    final ChannelID outputChannelID=channelIterator.next();
    final ChannelContext context=this.registeredChannels.remove(outputChannelID);
    if (context != null) {
      context.destroy();
    }
    this.receiverCache.remove(outputChannelID);
  }
  channelIterator=environment.getInputChannelIDs().iterator();
  while (channelIterator.hasNext()) {
    final ChannelID outputChannelID=channelIterator.next();
    final ChannelContext context=this.registeredChannels.remove(outputChannelID);
    if (context != null) {
      context.destroy();
    }
    this.receiverCache.remove(outputChannelID);
  }
  final Iterator<GateID> inputGateIterator=environment.getInputGateIDs().iterator();
  while (inputGateIterator.hasNext()) {
    final GateID inputGateID=inputGateIterator.next();
    final LocalBufferPoolOwner owner=this.localBufferPoolOwner.remove(inputGateID);
    if (owner != null) {
      owner.clearLocalBufferPool();
    }
  }
  final LocalBufferPoolOwner owner=this.localBufferPoolOwner.remove(vertexID);
  if (owner != null) {
    owner.clearLocalBufferPool();
  }
  redistributeGlobalBuffers();
}