Program: 6283
Project: 6283
Buggy source:
/** 
 * Subscribe to the streams heartbeat notification feed. One heartbeat contains data for all existing streams, we filter that to only take into account the streams that this   {@link DistributedStreamService} is a leaderof.
 * @return a {@link Cancellable} to cancel the subscription
 * @throws NotificationFeedNotFoundException if the heartbeat feed does not exist
 */
private Cancellable subscribeToHeartbeatsFeed() throws NotificationFeedNotFoundException {
  LOG.debug("String_Node_Str");
  final Id.NotificationFeed heartbeatsFeed=new Id.NotificationFeed.Builder().setNamespaceId(Id.Namespace.SYSTEM.getId()).setCategory(Constants.Notification.Stream.STREAM_INTERNAL_FEED_CATEGORY).setName(Constants.Notification.Stream.STREAM_HEARTBEAT_FEED_NAME).build();
  while (true) {
    try {
      return notificationService.subscribe(heartbeatsFeed,new NotificationHandler<StreamWriterHeartbeat>(){
        @Override public Type getNotificationType(){
          return StreamWriterHeartbeat.class;
        }
        @Override public void received(        StreamWriterHeartbeat heartbeat,        NotificationContext notificationContext){
          LOG.trace("String_Node_Str",heartbeat);
          for (          Map.Entry<Id.Stream,Long> entry : heartbeat.getStreamsSizes().entrySet()) {
            StreamSizeAggregator streamSizeAggregator=aggregators.get(entry.getKey());
            if (streamSizeAggregator == null) {
              LOG.trace("String_Node_Str",entry.getKey());
              continue;
            }
            streamSizeAggregator.bytesReceived(heartbeat.getInstanceId(),entry.getValue());
          }
        }
      }
,heartbeatsSubscriptionExecutor);
    }
 catch (    NotificationFeedException e) {
      waitBeforeRetryHeartbeatsFeedOperation();
    }
  }
}

Fixed version (ground truth):
/** 
 * Subscribe to the streams heartbeat notification feed. One heartbeat contains data for all existing streams, we filter that to only take into account the streams that this   {@link DistributedStreamService} is a leaderof.
 * @return a {@link Cancellable} to cancel the subscription
 * @throws NotificationFeedNotFoundException if the heartbeat feed does not exist
 */
private Cancellable subscribeToHeartbeatsFeed() throws NotificationFeedNotFoundException {
  LOG.debug("String_Node_Str");
  final Id.NotificationFeed heartbeatsFeed=new Id.NotificationFeed.Builder().setNamespaceId(Id.Namespace.SYSTEM.getId()).setCategory(Constants.Notification.Stream.STREAM_INTERNAL_FEED_CATEGORY).setName(Constants.Notification.Stream.STREAM_HEARTBEAT_FEED_NAME).build();
  boolean isRetry=false;
  while (true) {
    try {
      return notificationService.subscribe(heartbeatsFeed,new NotificationHandler<StreamWriterHeartbeat>(){
        @Override public Type getNotificationType(){
          return StreamWriterHeartbeat.class;
        }
        @Override public void received(        StreamWriterHeartbeat heartbeat,        NotificationContext notificationContext){
          LOG.trace("String_Node_Str",heartbeat);
          for (          Map.Entry<Id.Stream,Long> entry : heartbeat.getStreamsSizes().entrySet()) {
            StreamSizeAggregator streamSizeAggregator=aggregators.get(entry.getKey());
            if (streamSizeAggregator == null) {
              LOG.trace("String_Node_Str",entry.getKey());
              continue;
            }
            streamSizeAggregator.bytesReceived(heartbeat.getInstanceId(),entry.getValue());
          }
        }
      }
,heartbeatsSubscriptionExecutor);
    }
 catch (    NotificationFeedException e) {
      if (!isRetry) {
        LOG.warn("String_Node_Str" + "String_Node_Str",e);
      }
 else {
        LOG.debug("String_Node_Str",e);
      }
      isRetry=true;
      waitBeforeRetryHeartbeatsFeedOperation();
    }
  }
}