Program: 34527
Project: 34527
Buggy source:
/** 
 * This method is only called from code synched on the <code>freeLockObject</code>, so we do not have to worry about synchronizing access to <code>waiterCount</code>.
 */
private void queueRequest(ManagedConnectionFactory managedConnectionFactory,long waitTimeout) throws ResourceAllocationException, ConnectionWaitTimeoutException {
  if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
    Tr.entry(this,tc,"String_Node_Str",waitTimeout);
  }
  if (waitTimeout == 0) {
    --pm.waiterCount;
    Tr.error(tc,"String_Node_Str",new Object[]{"String_Node_Str",gConfigProps.cfName});
    ConnectionWaitTimeoutException cwte=new ConnectionWaitTimeoutException("String_Node_Str");
    com.ibm.ws.ffdc.FFDCFilter.processException(cwte,J2CConstants.DMSID_MAX_CONNECTIONS_REACHED,"String_Node_Str",this.pm);
    pm.activeRequest.decrementAndGet();
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())     Tr.exit(this,tc,"String_Node_Str",cwte);
    throw cwte;
  }
  if ((tc.isDebugEnabled())) {
    ++freePoolQueuedRequests;
    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
      String poolStats=pm.gatherPoolStatisticalData();
      Tr.debug(this,tc,"String_Node_Str" + gConfigProps.getXpathId() + "String_Node_Str");
      Tr.debug(this,tc,poolStats);
    }
  }
  try {
    if (pm.displayInfiniteWaitMessage) {
      Tr.info(tc,"String_Node_Str",gConfigProps.getXpathId());
      pm.displayInfiniteWaitMessage=false;
    }
    pm.activeRequest.decrementAndGet();
    pm.waiterFreePoolLock.wait(waitTimeout);
    pm.requestingAccessToPool();
  }
 catch (  InterruptedException ie) {
    if (tc.isDebugEnabled()) {
      Tr.debug(this,tc,"String_Node_Str");
    }
synchronized (pm.waiterFreePoolLock) {
      --pm.waiterCount;
    }
    if (tc.isDebugEnabled()) {
      if (pm.waiterCount == 0) {
        pm.waitersEndedTime=System.currentTimeMillis();
        Tr.debug(this,tc,"String_Node_Str" + pm.waitersEndedTime);
        Tr.debug(this,tc,"String_Node_Str" + (pm.waitersEndedTime - pm.waitersStartedTime));
      }
    }
    ResourceAllocationException throwMe=new ResourceAllocationException(ie.getMessage());
    throwMe.initCause(ie);
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())     Tr.exit(this,tc,"String_Node_Str",throwMe);
    throw throwMe;
  }
  if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
    Tr.exit(this,tc,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * This method is only called from code synched on the <code>freeLockObject</code>, so we do not have to worry about synchronizing access to <code>waiterCount</code>.
 */
private void queueRequest(ManagedConnectionFactory managedConnectionFactory,long waitTimeout) throws ResourceAllocationException, ConnectionWaitTimeoutException {
  if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
    Tr.entry(this,tc,"String_Node_Str",waitTimeout);
  }
  if (waitTimeout == 0) {
    --pm.waiterCount;
    Tr.error(tc,"String_Node_Str",new Object[]{"String_Node_Str",gConfigProps.cfName});
    ConnectionWaitTimeoutException cwte=new ConnectionWaitTimeoutException("String_Node_Str");
    com.ibm.ws.ffdc.FFDCFilter.processException(cwte,J2CConstants.DMSID_MAX_CONNECTIONS_REACHED,"String_Node_Str",this.pm);
    pm.activeRequest.decrementAndGet();
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())     Tr.exit(this,tc,"String_Node_Str",cwte);
    throw cwte;
  }
  if ((tc.isDebugEnabled())) {
    ++freePoolQueuedRequests;
    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
      String poolStats=pm.gatherPoolStatisticalData();
      Tr.debug(this,tc,"String_Node_Str" + gConfigProps.getXpathId() + "String_Node_Str");
      Tr.debug(this,tc,poolStats);
    }
  }
  try {
    if (pm.displayInfiniteWaitMessage) {
      Tr.info(tc,"String_Node_Str",gConfigProps.getXpathId());
      pm.displayInfiniteWaitMessage=false;
    }
    pm.activeRequest.decrementAndGet();
    if (waitTimeout < 0) {
      pm.waiterFreePoolLock.wait(0);
    }
 else {
      pm.waiterFreePoolLock.wait(waitTimeout);
    }
    pm.requestingAccessToPool();
  }
 catch (  InterruptedException ie) {
    if (tc.isDebugEnabled()) {
      Tr.debug(this,tc,"String_Node_Str");
    }
synchronized (pm.waiterFreePoolLock) {
      --pm.waiterCount;
    }
    if (tc.isDebugEnabled()) {
      if (pm.waiterCount == 0) {
        pm.waitersEndedTime=System.currentTimeMillis();
        Tr.debug(this,tc,"String_Node_Str" + pm.waitersEndedTime);
        Tr.debug(this,tc,"String_Node_Str" + (pm.waitersEndedTime - pm.waitersStartedTime));
      }
    }
    ResourceAllocationException throwMe=new ResourceAllocationException(ie.getMessage());
    throwMe.initCause(ie);
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())     Tr.exit(this,tc,"String_Node_Str",throwMe);
    throw throwMe;
  }
  if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
    Tr.exit(this,tc,"String_Node_Str");
  }
}