Program: 1500
Project: 1500
Buggy source:
private TAsyncClient newClient(Class<?> c,Connection connection) throws InterruptedException {
  BlockingQueue<TAsyncClient> blockingQueue=getQueue(connection);
  TAsyncClient client=blockingQueue.poll();
  if (client != null) {
    return client;
  }
  int numOfConnections=_numberOfConnections.get();
  while (numOfConnections >= _maxConnectionsPerHost) {
    client=blockingQueue.poll(_pollTime,TimeUnit.MILLISECONDS);
    if (client != null) {
      return client;
    }
    LOG.debug("String_Node_Str",numOfConnections,_maxConnectionsPerHost);
    numOfConnections=_numberOfConnections.get();
  }
  LOG.info("String_Node_Str",connection);
  String name=c.getName();
  Constructor<?> constructor=_constructorCache.get(name);
  if (constructor == null) {
    String clientClassName=name.replace("String_Node_Str","String_Node_Str");
    try {
      Class<?> clazz=Class.forName(clientClassName);
      constructor=clazz.getConstructor(new Class[]{TProtocolFactory.class,TAsyncClientManager.class,TNonblockingTransport.class});
      _constructorCache.put(name,constructor);
    }
 catch (    Exception e) {
      throw new RuntimeException(e);
    }
  }
  try {
    client=(TAsyncClient)constructor.newInstance(new Object[]{_protocolFactory,_clientManager,newTransport(connection)});
    client.setTimeout(_timeout);
    _numberOfConnections.incrementAndGet();
    return client;
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
private TAsyncClient newClient(Class<?> c,Connection connection) throws InterruptedException {
  BlockingQueue<TAsyncClient> blockingQueue=getQueue(connection);
  TAsyncClient client=blockingQueue.poll();
  if (client != null) {
    return client;
  }
  AtomicInteger counter;
synchronized (_numberOfConnections) {
    counter=_numberOfConnections.get(connection._host);
    if (counter == null) {
      counter=new AtomicInteger();
      _numberOfConnections.put(connection._host,counter);
    }
  }
synchronized (counter) {
    int numOfConnections=counter.get();
    while (numOfConnections >= _maxConnectionsPerHost) {
      client=blockingQueue.poll(_pollTime,TimeUnit.MILLISECONDS);
      if (client != null) {
        return client;
      }
      LOG.debug("String_Node_Str" + numOfConnections + "String_Node_Str"+ _maxConnectionsPerHost+ "String_Node_Str");
      numOfConnections=counter.get();
    }
    LOG.info("String_Node_Str" + connection + "String_Node_Str");
    String name=c.getName();
    Constructor<?> constructor=_constructorCache.get(name);
    if (constructor == null) {
      String clientClassName=name.replace("String_Node_Str","String_Node_Str");
      try {
        Class<?> clazz=Class.forName(clientClassName);
        constructor=clazz.getConstructor(new Class[]{TProtocolFactory.class,TAsyncClientManager.class,TNonblockingTransport.class});
        _constructorCache.put(name,constructor);
      }
 catch (      Exception e) {
        throw new RuntimeException(e);
      }
    }
    try {
      client=(TAsyncClient)constructor.newInstance(new Object[]{_protocolFactory,_clientManager,newTransport(connection)});
      client.setTimeout(_timeout);
      counter.incrementAndGet();
      return client;
    }
 catch (    Exception e) {
      throw new RuntimeException(e);
    }
  }
}