Program: 82514
Project: 82514
Buggy source:
public static void main(String[] args) throws TTransportException, IOException, KeeperException, InterruptedException, BlurException {
  int serverIndex=getServerIndex(args);
  LOG.info("String_Node_Str");
  Thread.setDefaultUncaughtExceptionHandler(new SimpleUncaughtExceptionHandler());
  BlurConfiguration configuration=new BlurConfiguration();
  int numberOfBlocksPerBank=16384;
  int blockSize=BlockDirectory.BLOCK_SIZE;
  int bankCount=configuration.getInt(BLUR_SHARD_BLOCKCACHE_SLAB_COUNT,1);
  Configuration config=new Configuration();
  BlurMetrics blurMetrics=new BlurMetrics(config);
  boolean directAllocation=configuration.getBoolean(BLUR_SHARD_BLOCKCACHE_DIRECT_MEMORY_ALLOCATION,true);
  int slabSize=numberOfBlocksPerBank * blockSize;
  LOG.info("String_Node_Str",bankCount,directAllocation);
  LOG.info("String_Node_Str",slabSize,bankCount,((long)bankCount * (long)slabSize));
  BufferStore.init(configuration,blurMetrics);
  BlockCache blockCache;
  try {
    long totalMemory=bankCount * numberOfBlocksPerBank * blockSize;
    blockCache=new BlockCache(blurMetrics,directAllocation,totalMemory,slabSize,blockSize);
  }
 catch (  OutOfMemoryError e) {
    if ("String_Node_Str".equals(e.getMessage())) {
      System.err.println("String_Node_Str");
      System.exit(1);
    }
    throw e;
  }
  BlockDirectoryCache cache=new BlockDirectoryCache(blockCache,blurMetrics);
  String bindAddress=configuration.get(BLUR_SHARD_BIND_ADDRESS);
  int bindPort=configuration.getInt(BLUR_SHARD_BIND_PORT,-1);
  bindPort+=serverIndex;
  LOG.info("String_Node_Str",serverIndex,bindAddress + "String_Node_Str" + bindPort);
  String nodeNameHostName=getNodeName(configuration,BLUR_SHARD_HOSTNAME);
  String nodeName=nodeNameHostName + "String_Node_Str" + bindPort;
  String zkConnectionStr=isEmpty(configuration.get(BLUR_ZOOKEEPER_CONNECTION),BLUR_ZOOKEEPER_CONNECTION);
  BlurQueryChecker queryChecker=new BlurQueryChecker(configuration);
  final ZooKeeper zooKeeper=ZkUtils.newZooKeeper(zkConnectionStr);
  try {
    ZookeeperSystemTime.checkSystemTime(zooKeeper,configuration.getLong(BLUR_ZOOKEEPER_SYSTEM_TIME_TOLERANCE,3000));
  }
 catch (  KeeperException e) {
    if (e.code() == Code.CONNECTIONLOSS) {
      System.err.println("String_Node_Str" + zkConnectionStr + "String_Node_Str");
      System.exit(1);
    }
  }
  final ZookeeperClusterStatus clusterStatus=new ZookeeperClusterStatus(zooKeeper);
  final BlurIndexRefresher refresher=new BlurIndexRefresher();
  refresher.init();
  BlurFilterCache filterCache=getFilterCache(configuration);
  BlurIndexWarmup indexWarmup=getIndexWarmup(configuration);
  IndexDeletionPolicy indexDeletionPolicy=new TimeBasedIndexDeletionPolicy(configuration.getLong(BLUR_SHARD_INDEX_DELETION_POLICY_MAXAGE,60000));
  final DistributedIndexServer indexServer=new DistributedIndexServer();
  indexServer.setBlurMetrics(blurMetrics);
  indexServer.setCache(cache);
  indexServer.setClusterStatus(clusterStatus);
  indexServer.setConfiguration(config);
  indexServer.setNodeName(nodeName);
  indexServer.setRefresher(refresher);
  indexServer.setShardOpenerThreadCount(configuration.getInt(BLUR_SHARD_OPENER_THREAD_COUNT,16));
  indexServer.setZookeeper(zooKeeper);
  indexServer.setFilterCache(filterCache);
  indexServer.setSafeModeDelay(configuration.getLong(BLUR_SHARD_SAFEMODEDELAY,60000));
  indexServer.setWarmup(indexWarmup);
  indexServer.setIndexDeletionPolicy(indexDeletionPolicy);
  indexServer.setTimeBetweenCommits(configuration.getLong(BLUR_SHARD_TIME_BETWEEN_COMMITS,60000));
  indexServer.setTimeBetweenRefreshs(configuration.getLong(BLUR_SHARD_TIME_BETWEEN_REFRESHS,500));
  indexServer.init();
  final IndexManager indexManager=new IndexManager();
  indexManager.setIndexServer(indexServer);
  indexManager.setMaxClauseCount(configuration.getInt(BLUR_MAX_CLAUSE_COUNT,1024));
  indexManager.setThreadCount(configuration.getInt(BLUR_INDEXMANAGER_SEARCH_THREAD_COUNT,32));
  indexManager.setBlurMetrics(blurMetrics);
  indexManager.setFilterCache(filterCache);
  indexManager.init();
  final BlurShardServer shardServer=new BlurShardServer();
  shardServer.setIndexServer(indexServer);
  shardServer.setIndexManager(indexManager);
  shardServer.setZookeeper(zooKeeper);
  shardServer.setClusterStatus(clusterStatus);
  shardServer.setDataFetchThreadCount(configuration.getInt(BLUR_SHARD_DATA_FETCH_THREAD_COUNT,8));
  shardServer.setMaxQueryCacheElements(configuration.getInt(BLUR_SHARD_CACHE_MAX_QUERYCACHE_ELEMENTS,128));
  shardServer.setMaxTimeToLive(configuration.getLong(BLUR_SHARD_CACHE_MAX_TIMETOLIVE,TimeUnit.MINUTES.toMillis(1)));
  shardServer.setQueryChecker(queryChecker);
  shardServer.init();
  Iface iface=BlurUtil.recordMethodCallsAndAverageTimes(blurMetrics,shardServer,Iface.class);
  int threadCount=configuration.getInt(BLUR_SHARD_SERVER_THRIFT_THREAD_COUNT,32);
  final ThriftBlurShardServer server=new ThriftBlurShardServer();
  server.setNodeName(nodeName);
  server.setBindAddress(bindAddress);
  server.setBindPort(bindPort);
  server.setThreadCount(threadCount);
  server.setIface(iface);
  server.setConfiguration(configuration);
  new BlurServerShutDown().register(new BlurShutdown(){
    @Override public void shutdown(){
      ThreadWatcher threadWatcher=ThreadWatcher.instance();
      quietClose(refresher,server,shardServer,indexManager,indexServer,threadWatcher);
      System.exit(0);
    }
  }
,zooKeeper);
  server.start();
}

Fixed version (ground truth):
public static void main(String[] args) throws TTransportException, IOException, KeeperException, InterruptedException, BlurException {
  int serverIndex=getServerIndex(args);
  LOG.info("String_Node_Str");
  Thread.setDefaultUncaughtExceptionHandler(new SimpleUncaughtExceptionHandler());
  BlurConfiguration configuration=new BlurConfiguration();
  int numberOfBlocksPerBank=16384;
  int blockSize=BlockDirectory.BLOCK_SIZE;
  int bankCount=configuration.getInt(BLUR_SHARD_BLOCKCACHE_SLAB_COUNT,1);
  Configuration config=new Configuration();
  BlurMetrics blurMetrics=new BlurMetrics(config);
  boolean directAllocation=configuration.getBoolean(BLUR_SHARD_BLOCKCACHE_DIRECT_MEMORY_ALLOCATION,true);
  int slabSize=numberOfBlocksPerBank * blockSize;
  LOG.info("String_Node_Str",bankCount,directAllocation);
  LOG.info("String_Node_Str",slabSize,bankCount,((long)bankCount * (long)slabSize));
  BufferStore.init(configuration,blurMetrics);
  BlockCache blockCache;
  try {
    long totalMemory=(long)bankCount * (long)numberOfBlocksPerBank * (long)blockSize;
    blockCache=new BlockCache(blurMetrics,directAllocation,totalMemory,slabSize,blockSize);
  }
 catch (  OutOfMemoryError e) {
    if ("String_Node_Str".equals(e.getMessage())) {
      System.err.println("String_Node_Str");
      System.exit(1);
    }
    throw e;
  }
  BlockDirectoryCache cache=new BlockDirectoryCache(blockCache,blurMetrics);
  String bindAddress=configuration.get(BLUR_SHARD_BIND_ADDRESS);
  int bindPort=configuration.getInt(BLUR_SHARD_BIND_PORT,-1);
  bindPort+=serverIndex;
  LOG.info("String_Node_Str",serverIndex,bindAddress + "String_Node_Str" + bindPort);
  String nodeNameHostName=getNodeName(configuration,BLUR_SHARD_HOSTNAME);
  String nodeName=nodeNameHostName + "String_Node_Str" + bindPort;
  String zkConnectionStr=isEmpty(configuration.get(BLUR_ZOOKEEPER_CONNECTION),BLUR_ZOOKEEPER_CONNECTION);
  BlurQueryChecker queryChecker=new BlurQueryChecker(configuration);
  final ZooKeeper zooKeeper=ZkUtils.newZooKeeper(zkConnectionStr);
  try {
    ZookeeperSystemTime.checkSystemTime(zooKeeper,configuration.getLong(BLUR_ZOOKEEPER_SYSTEM_TIME_TOLERANCE,3000));
  }
 catch (  KeeperException e) {
    if (e.code() == Code.CONNECTIONLOSS) {
      System.err.println("String_Node_Str" + zkConnectionStr + "String_Node_Str");
      System.exit(1);
    }
  }
  final ZookeeperClusterStatus clusterStatus=new ZookeeperClusterStatus(zooKeeper);
  final BlurIndexRefresher refresher=new BlurIndexRefresher();
  refresher.init();
  BlurFilterCache filterCache=getFilterCache(configuration);
  BlurIndexWarmup indexWarmup=getIndexWarmup(configuration);
  IndexDeletionPolicy indexDeletionPolicy=new TimeBasedIndexDeletionPolicy(configuration.getLong(BLUR_SHARD_INDEX_DELETION_POLICY_MAXAGE,60000));
  final DistributedIndexServer indexServer=new DistributedIndexServer();
  indexServer.setBlurMetrics(blurMetrics);
  indexServer.setCache(cache);
  indexServer.setClusterStatus(clusterStatus);
  indexServer.setConfiguration(config);
  indexServer.setNodeName(nodeName);
  indexServer.setRefresher(refresher);
  indexServer.setShardOpenerThreadCount(configuration.getInt(BLUR_SHARD_OPENER_THREAD_COUNT,16));
  indexServer.setZookeeper(zooKeeper);
  indexServer.setFilterCache(filterCache);
  indexServer.setSafeModeDelay(configuration.getLong(BLUR_SHARD_SAFEMODEDELAY,60000));
  indexServer.setWarmup(indexWarmup);
  indexServer.setIndexDeletionPolicy(indexDeletionPolicy);
  indexServer.setTimeBetweenCommits(configuration.getLong(BLUR_SHARD_TIME_BETWEEN_COMMITS,60000));
  indexServer.setTimeBetweenRefreshs(configuration.getLong(BLUR_SHARD_TIME_BETWEEN_REFRESHS,500));
  indexServer.init();
  final IndexManager indexManager=new IndexManager();
  indexManager.setIndexServer(indexServer);
  indexManager.setMaxClauseCount(configuration.getInt(BLUR_MAX_CLAUSE_COUNT,1024));
  indexManager.setThreadCount(configuration.getInt(BLUR_INDEXMANAGER_SEARCH_THREAD_COUNT,32));
  indexManager.setBlurMetrics(blurMetrics);
  indexManager.setFilterCache(filterCache);
  indexManager.init();
  final BlurShardServer shardServer=new BlurShardServer();
  shardServer.setIndexServer(indexServer);
  shardServer.setIndexManager(indexManager);
  shardServer.setZookeeper(zooKeeper);
  shardServer.setClusterStatus(clusterStatus);
  shardServer.setDataFetchThreadCount(configuration.getInt(BLUR_SHARD_DATA_FETCH_THREAD_COUNT,8));
  shardServer.setMaxQueryCacheElements(configuration.getInt(BLUR_SHARD_CACHE_MAX_QUERYCACHE_ELEMENTS,128));
  shardServer.setMaxTimeToLive(configuration.getLong(BLUR_SHARD_CACHE_MAX_TIMETOLIVE,TimeUnit.MINUTES.toMillis(1)));
  shardServer.setQueryChecker(queryChecker);
  shardServer.init();
  Iface iface=BlurUtil.recordMethodCallsAndAverageTimes(blurMetrics,shardServer,Iface.class);
  int threadCount=configuration.getInt(BLUR_SHARD_SERVER_THRIFT_THREAD_COUNT,32);
  final ThriftBlurShardServer server=new ThriftBlurShardServer();
  server.setNodeName(nodeName);
  server.setBindAddress(bindAddress);
  server.setBindPort(bindPort);
  server.setThreadCount(threadCount);
  server.setIface(iface);
  server.setConfiguration(configuration);
  new BlurServerShutDown().register(new BlurShutdown(){
    @Override public void shutdown(){
      ThreadWatcher threadWatcher=ThreadWatcher.instance();
      quietClose(refresher,server,shardServer,indexManager,indexServer,threadWatcher);
      System.exit(0);
    }
  }
,zooKeeper);
  server.start();
}