Program: 37528
Project: 37528
Buggy source:
/** 
 * 检查 redis key
 */
private void checkListKeyLength(){
  if (!isChecking.compareAndSet(false,true)) {
    return;
  }
  try {
    lastCheckTime=TimeUtil.currentTimeMillis();
    for (    java.util.Map.Entry<String,String[]> listKey : keyMap.entrySet()) {
      String key=listKey.getKey();
      String[] value=listKey.getValue();
      String password=value[0];
      String cmd=value[1];
      UserCfg userCfg=RedisEngineCtx.INSTANCE().getUserMap().get(password);
      if (userCfg != null) {
        AbstractPool pool=RedisEngineCtx.INSTANCE().getPoolMap().get(userCfg.getPoolId());
        PhysicalNode physicalNode=pool.getPhysicalNode();
        JedisConnection conn=null;
        try {
          conn=new JedisConnection(physicalNode.getHost(),physicalNode.getPort(),1000,0);
          conn.sendCommand(RedisCommand.READONLY);
          conn.getBulkReply();
          if (cmd.equals("String_Node_Str") || cmd.equals("String_Node_Str") || cmd.equals("String_Node_Str")|| cmd.equals("String_Node_Str")|| cmd.equals("String_Node_Str")) {
            conn.sendCommand(RedisCommand.HLEN,key);
          }
 else           if (cmd.equals("String_Node_Str") || cmd.equals("String_Node_Str") || cmd.equals("String_Node_Str")|| cmd.equals("String_Node_Str")) {
            conn.sendCommand(RedisCommand.LLEN,key);
          }
 else           if (cmd.equals("String_Node_Str")) {
            conn.sendCommand(RedisCommand.SCARD,key);
          }
 else           if (cmd.equals("String_Node_Str") || cmd.equals("String_Node_Str") || cmd.equals("String_Node_Str")) {
            conn.sendCommand(RedisCommand.ZCARD,key);
          }
          long length=conn.getIntegerReply();
          if (length > THRESHOLD) {
            BigLength bigLen=bigLengthMap.get(key);
            if (bigLen == null) {
              bigLen=new BigLength();
              bigLen.cmd=cmd;
              bigLen.key=key;
            }
            bigLen.length.set((int)length);
          }
 else {
            keyMap.remove(key);
          }
          BigLength min=null;
          for (          BigLength bigLen : bigLengthMap.values()) {
            if (min == null) {
              min=bigLen;
            }
 else {
              if (bigLen.length.get() < min.length.get()) {
                min=bigLen;
              }
            }
          }
          if (min != null)           bigLengthMap.remove(min.key);
        }
 catch (        JedisDataException e1) {
        }
catch (        JedisConnectionException e2) {
          LOGGER.error("String_Node_Str",e2);
        }
 finally {
          if (conn != null) {
            conn.disconnect();
          }
        }
      }
    }
  }
  finally {
    isChecking.set(false);
  }
}

Fixed version (ground truth):
/** 
 * 检查 redis key
 */
private void checkListKeyLength(){
  if (!isChecking.compareAndSet(false,true)) {
    return;
  }
  try {
    lastCheckTime=TimeUtil.currentTimeMillis();
    for (    java.util.Map.Entry<String,String[]> listKey : keyMap.entrySet()) {
      String key=listKey.getKey();
      String[] value=listKey.getValue();
      String password=value[0];
      String cmd=value[1];
      UserCfg userCfg=RedisEngineCtx.INSTANCE().getUserMap().get(password);
      if (userCfg != null) {
        AbstractPool pool=RedisEngineCtx.INSTANCE().getPoolMap().get(userCfg.getPoolId());
        PhysicalNode physicalNode;
        if (pool.getType() == 1) {
          physicalNode=pool.getPhysicalNode(cmd,key);
        }
 else {
          physicalNode=pool.getPhysicalNode();
        }
        JedisConnection conn=null;
        try {
          conn=new JedisConnection(physicalNode.getHost(),physicalNode.getPort(),1000,0);
          if (cmd.equals("String_Node_Str") || cmd.equals("String_Node_Str") || cmd.equals("String_Node_Str")|| cmd.equals("String_Node_Str")|| cmd.equals("String_Node_Str")) {
            conn.sendCommand(RedisCommand.HLEN,key);
          }
 else           if (cmd.equals("String_Node_Str") || cmd.equals("String_Node_Str") || cmd.equals("String_Node_Str")|| cmd.equals("String_Node_Str")) {
            conn.sendCommand(RedisCommand.LLEN,key);
          }
 else           if (cmd.equals("String_Node_Str")) {
            conn.sendCommand(RedisCommand.SCARD,key);
          }
 else           if (cmd.equals("String_Node_Str") || cmd.equals("String_Node_Str") || cmd.equals("String_Node_Str")) {
            conn.sendCommand(RedisCommand.ZCARD,key);
          }
          long length=conn.getIntegerReply();
          if (length > THRESHOLD) {
            BigLength bigLen=bigLengthMap.get(key);
            if (bigLen == null) {
              bigLen=new BigLength();
              bigLen.cmd=cmd;
              bigLen.key=key;
            }
            bigLen.length.set((int)length);
          }
 else {
            keyMap.remove(key);
          }
          BigLength min=null;
          for (          BigLength bigLen : bigLengthMap.values()) {
            if (min == null) {
              min=bigLen;
            }
 else {
              if (bigLen.length.get() < min.length.get()) {
                min=bigLen;
              }
            }
          }
          if (min != null)           bigLengthMap.remove(min.key);
        }
 catch (        JedisDataException e1) {
        }
catch (        JedisConnectionException e2) {
          LOGGER.error("String_Node_Str",e2);
        }
 finally {
          if (conn != null) {
            conn.disconnect();
          }
        }
      }
    }
  }
  finally {
    isChecking.set(false);
  }
}