Program: 30727
Project: 30727
Buggy source:
public boolean lock(CharSequence name){
  checkClosed();
  Entry e=entries.get(name);
  if (e == null) {
    LOG.info().$('\'').$(name).$("String_Node_Str").$();
    return true;
  }
  long thread=Thread.currentThread().getId();
  if (Unsafe.cas(e,LOCK_OWNER,UNLOCKED,thread) || Unsafe.cas(e,LOCK_OWNER,thread,thread)) {
    do {
      for (int i=0; i < ENTRY_SIZE; i++) {
        if (Unsafe.cas(e.allocations,i,UNALLOCATED,thread)) {
          closeReader(thread,e,i,PoolListener.EV_LOCK_CLOSE,PoolConstants.CR_NAME_LOCK);
        }
 else         if (Unsafe.cas(e.allocations,i,thread,thread)) {
          if (Unsafe.arrayGet(e.readers,i) != null) {
            e.lockOwner=-1L;
            return false;
          }
        }
 else {
          LOG.info().$("String_Node_Str").$(name).$("String_Node_Str").$(e.index).$(':').$(i).$("String_Node_Str").$(Unsafe.arrayGet(e.allocations,i)).$("String_Node_Str").$(thread).$(']').$();
          e.lockOwner=-1L;
          return false;
        }
      }
      if (e.next == null) {
        if (Unsafe.getUnsafe().compareAndSwapInt(e,NEXT_STATUS,NEXT_OPEN,NEXT_LOCKED)) {
          break;
        }
 else {
          if (e.next == null) {
            LOG.info().$("String_Node_Str").$(name).$("String_Node_Str").$(e.index + 1).$(':').$(0).$("String_Node_Str").$("String_Node_Str").$(thread).$(']').$();
            e.lockOwner=-1L;
            return false;
          }
        }
      }
      e=e.next;
    }
 while (e != null);
  }
 else {
    LOG.error().$('\'').$(name).$("String_Node_Str").$(e.lockOwner).$(']').$();
    notifyListener(thread,name,PoolListener.EV_LOCK_BUSY,-1,-1);
    return false;
  }
  notifyListener(thread,name,PoolListener.EV_LOCK_SUCCESS,-1,-1);
  LOG.info().$('\'').$(name).$("String_Node_Str").$(thread).$(']').$();
  return true;
}

Fixed version (ground truth):
public boolean lock(CharSequence name){
  checkClosed();
  Entry e=entries.get(name);
  if (e == null) {
    e=new Entry(0,clock.getTicks());
    Entry other=entries.putIfAbsent(name,e);
    if (other != null) {
      e=other;
    }
  }
  long thread=Thread.currentThread().getId();
  if (Unsafe.cas(e,LOCK_OWNER,UNLOCKED,thread) || Unsafe.cas(e,LOCK_OWNER,thread,thread)) {
    do {
      for (int i=0; i < ENTRY_SIZE; i++) {
        if (Unsafe.cas(e.allocations,i,UNALLOCATED,thread)) {
          closeReader(thread,e,i,PoolListener.EV_LOCK_CLOSE,PoolConstants.CR_NAME_LOCK);
        }
 else         if (Unsafe.cas(e.allocations,i,thread,thread)) {
          if (Unsafe.arrayGet(e.readers,i) != null) {
            e.lockOwner=-1L;
            return false;
          }
        }
 else {
          LOG.info().$("String_Node_Str").$(name).$("String_Node_Str").$(e.index).$(':').$(i).$("String_Node_Str").$(Unsafe.arrayGet(e.allocations,i)).$("String_Node_Str").$(thread).$(']').$();
          e.lockOwner=-1L;
          return false;
        }
      }
      if (e.next == null) {
        if (Unsafe.getUnsafe().compareAndSwapInt(e,NEXT_STATUS,NEXT_OPEN,NEXT_LOCKED)) {
          break;
        }
 else {
          if (e.next == null) {
            LOG.info().$("String_Node_Str").$(name).$("String_Node_Str").$(e.index + 1).$(':').$(0).$("String_Node_Str").$("String_Node_Str").$(thread).$(']').$();
            e.lockOwner=-1L;
            return false;
          }
        }
      }
      e=e.next;
    }
 while (e != null);
  }
 else {
    LOG.error().$('\'').$(name).$("String_Node_Str").$(e.lockOwner).$(']').$();
    notifyListener(thread,name,PoolListener.EV_LOCK_BUSY,-1,-1);
    return false;
  }
  notifyListener(thread,name,PoolListener.EV_LOCK_SUCCESS,-1,-1);
  LOG.info().$('\'').$(name).$("String_Node_Str").$(thread).$(']').$();
  return true;
}