Program: 106904
Project: 106904
Buggy source:
@Override public void run(){
  s_logger.info("String_Node_Str");
  try {
    Thread.sleep(_pingTimeout * 2000);
  }
 catch (  InterruptedException e) {
    s_logger.info("String_Node_Str");
  }
  while (!_stop) {
    try {
      Thread.sleep(60 * 1000);
    }
 catch (    InterruptedException e) {
      s_logger.info("String_Node_Str");
    }
    GlobalLock lock=GlobalLock.getInternLock("String_Node_Str");
    if (lock == null) {
      s_logger.error("String_Node_Str");
      continue;
    }
    if (!lock.lock(10)) {
      s_logger.info("String_Node_Str");
      continue;
    }
    try {
      long time=(System.currentTimeMillis() >> 10) - _pingTimeout;
      List<HostVO> hosts=_hostDao.findLostHosts(time);
      if (s_logger.isInfoEnabled()) {
        s_logger.info("String_Node_Str" + hosts.size() + "String_Node_Str"+ _pingTimeout+ "String_Node_Str"+ time);
      }
      for (      HostVO host : hosts) {
        if (host.getType().equals(Host.Type.ExternalFirewall) || host.getType().equals(Host.Type.ExternalLoadBalancer) || host.getType().equals(Host.Type.TrafficMonitor)|| host.getType().equals(Host.Type.SecondaryStorage)) {
          continue;
        }
        if (host.getManagementServerId() == null || host.getManagementServerId() == _msId) {
          if (s_logger.isInfoEnabled()) {
            s_logger.info("String_Node_Str" + host.getId() + "String_Node_Str"+ host.getLastPinged());
          }
          _agentMgr.disconnect(host.getId(),Event.PingTimeout,true);
        }
      }
      hosts=_hostDao.listByStatus(Status.PrepareForMaintenance,Status.ErrorInMaintenance);
      for (      HostVO host : hosts) {
        long hostId=host.getId();
        DataCenterVO dcVO=_dcDao.findById(host.getDataCenterId());
        HostPodVO podVO=_podDao.findById(host.getPodId());
        String hostDesc="String_Node_Str" + host.getName() + "String_Node_Str"+ host.getId()+ "String_Node_Str"+ dcVO.getName()+ "String_Node_Str"+ podVO.getName();
        if (host.getType() != Host.Type.Storage) {
          List<VMInstanceVO> vos=_vmDao.listByHostId(host.getId());
          if (vos.size() == 0) {
            _alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST,host.getDataCenterId(),host.getPodId(),"String_Node_Str" + hostDesc,"String_Node_Str" + hostDesc + "String_Node_Str");
            _hostDao.updateStatus(host,Event.PreparationComplete,_msId);
          }
        }
      }
    }
 catch (    Throwable th) {
      s_logger.error("String_Node_Str",th);
    }
 finally {
      lock.unlock();
    }
  }
  s_logger.info("String_Node_Str");
}

Fixed version (ground truth):
@Override public void run(){
  s_logger.info("String_Node_Str");
  while (!_stop) {
    try {
      Thread.sleep(60 * 1000);
    }
 catch (    InterruptedException e) {
      s_logger.info("String_Node_Str");
    }
    GlobalLock lock=GlobalLock.getInternLock("String_Node_Str");
    if (lock == null) {
      s_logger.error("String_Node_Str");
      continue;
    }
    if (!lock.lock(10)) {
      s_logger.info("String_Node_Str");
      continue;
    }
    try {
      long time=(System.currentTimeMillis() >> 10) - _pingTimeout;
      List<HostVO> hosts=_hostDao.findLostHosts(time);
      if (s_logger.isInfoEnabled()) {
        s_logger.info("String_Node_Str" + hosts.size() + "String_Node_Str"+ _pingTimeout+ "String_Node_Str"+ time);
      }
      for (      HostVO host : hosts) {
        if (host.getType().equals(Host.Type.ExternalFirewall) || host.getType().equals(Host.Type.ExternalLoadBalancer) || host.getType().equals(Host.Type.TrafficMonitor)|| host.getType().equals(Host.Type.SecondaryStorage)) {
          continue;
        }
        if (host.getManagementServerId() == null || host.getManagementServerId() == _msId) {
          if (s_logger.isInfoEnabled()) {
            s_logger.info("String_Node_Str" + host.getId() + "String_Node_Str"+ host.getLastPinged());
          }
          _agentMgr.disconnect(host.getId(),Event.PingTimeout,true);
        }
      }
      hosts=_hostDao.listByStatus(Status.PrepareForMaintenance,Status.ErrorInMaintenance);
      for (      HostVO host : hosts) {
        long hostId=host.getId();
        DataCenterVO dcVO=_dcDao.findById(host.getDataCenterId());
        HostPodVO podVO=_podDao.findById(host.getPodId());
        String hostDesc="String_Node_Str" + host.getName() + "String_Node_Str"+ host.getId()+ "String_Node_Str"+ dcVO.getName()+ "String_Node_Str"+ podVO.getName();
        if (host.getType() != Host.Type.Storage) {
          List<VMInstanceVO> vos=_vmDao.listByHostId(host.getId());
          if (vos.size() == 0) {
            _alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST,host.getDataCenterId(),host.getPodId(),"String_Node_Str" + hostDesc,"String_Node_Str" + hostDesc + "String_Node_Str");
            _hostDao.updateStatus(host,Event.PreparationComplete,_msId);
          }
        }
      }
    }
 catch (    Throwable th) {
      s_logger.error("String_Node_Str",th);
    }
 finally {
      lock.unlock();
    }
  }
  s_logger.info("String_Node_Str");
}