Program: 55312
Project: 55312
Buggy source:
/** 
 * publishes changes - this method pushes the replication events
 * @param mi               the modification iterator that notifies us of changes
 * @param remote           details about the remote connection
 * @param remoteIdentifier
 */
void publish(@NotNull final ModificationIterator mi,@NotNull final Bootstrap remote,byte remoteIdentifier){
  final TcpChannelHub hub=this.hub;
  mi.setModificationNotifier(eventLoop::unpause);
  eventLoop.addHandler(true,new EventHandler(){
    final Bytes bytes=Bytes.elasticByteBuffer();
    final Wire wire=wireType.apply(bytes);
    boolean hasSentLastUpdateTime=false;
    long lastUpdateTime=0;
    boolean hasLogged;
    @Override public boolean action() throws InvalidEventHandlerException {
      if (hub.isOutBytesLocked())       return false;
      if (!hub.isOutBytesEmpty())       return false;
      if (ReplicationHub.this.isClosed.get())       throw new InvalidEventHandlerException();
      bytes.clear();
      if (!mi.hasNext()) {
        if (!hasSentLastUpdateTime && lastUpdateTime > 0) {
          wire.writeNotReadyDocument(false,wire -> {
            wire.writeEventName(CoreFields.lastUpdateTime).int64(lastUpdateTime);
            wire.write(() -> "String_Node_Str").int8(remoteIdentifier);
          }
);
          hasSentLastUpdateTime=true;
          if (!hasLogged) {
            System.out.println("String_Node_Str" + "String_Node_Str" + remoteIdentifier);
            hasLogged=true;
          }
          if (bytes.readRemaining() > 0) {
            ReplicationHub.this.sendBytes(bytes,false);
            return true;
          }
          return false;
        }
      }
      mi.nextEntry(e -> {
        long updateTime=Math.max(lastUpdateTime,e.timestamp());
        if (updateTime > lastUpdateTime) {
          hasSentLastUpdateTime=false;
          lastUpdateTime=updateTime;
        }
        wire.writeDocument(false,wireOut -> wireOut.writeEventName(replicationEvent).typedMarshallable(e));
      }
);
      if (bytes.readRemaining() > 0) {
        ReplicationHub.this.sendBytes(bytes,false);
        return true;
      }
      return false;
    }
    public HandlerPriority priority(){
      return HandlerPriority.REPLICATION;
    }
  }
);
  mi.dirtyEntries(remote.lastUpdatedTime());
}

Fixed version (ground truth):
/** 
 * publishes changes - this method pushes the replication events
 * @param mi               the modification iterator that notifies us of changes
 * @param remote           details about the remote connection
 * @param remoteIdentifier
 */
void publish(@NotNull final ModificationIterator mi,@NotNull final Bootstrap remote,byte remoteIdentifier){
  final TcpChannelHub hub=this.hub;
  mi.setModificationNotifier(eventLoop::unpause);
  eventLoop.addHandler(true,new EventHandler(){
    final Bytes bytes=Bytes.elasticByteBuffer();
    final Wire wire=wireType.apply(bytes);
    boolean hasSentLastUpdateTime=false;
    long lastUpdateTime=0;
    boolean hasLogged;
    @Override public boolean action() throws InvalidEventHandlerException {
      if (hub.isOutBytesLocked())       return false;
      if (!hub.isOutBytesEmpty())       return false;
      if (ReplicationHub.this.isClosed.get())       throw new InvalidEventHandlerException();
      bytes.clear();
      if (!mi.hasNext()) {
        if (!hasSentLastUpdateTime && lastUpdateTime > 0) {
          wire.writeNotReadyDocument(false,wire -> {
            wire.writeEventName(CoreFields.lastUpdateTime).int64(lastUpdateTime);
            wire.write(() -> "String_Node_Str").int8(remoteIdentifier);
          }
);
          hasSentLastUpdateTime=true;
          if (!hasLogged) {
            System.out.println("String_Node_Str" + "String_Node_Str" + remoteIdentifier);
            hasLogged=true;
          }
          if (bytes.readRemaining() > 0) {
            ReplicationHub.this.sendBytes(bytes,false);
            return true;
          }
          return false;
        }
      }
      mi.nextEntry(e -> {
        long updateTime=Math.max(lastUpdateTime,e.timestamp());
        if (updateTime > lastUpdateTime) {
          hasSentLastUpdateTime=false;
          lastUpdateTime=updateTime;
        }
        wire.writeNotReadyDocument(false,wireOut -> wireOut.writeEventName(replicationEvent).typedMarshallable(e));
      }
);
      if (bytes.readRemaining() > 0) {
        ReplicationHub.this.sendBytes(bytes,false);
        return true;
      }
      return false;
    }
    public HandlerPriority priority(){
      return HandlerPriority.REPLICATION;
    }
  }
);
  mi.dirtyEntries(remote.lastUpdatedTime());
}