Program: 113459
Project: 113459
Buggy source:
/** 
 * Adds writeBuffer to the list of pending writes and sends it to the OSD specified by writeBuffer.uuidIterator (or write_buffer.osdUuid if writeBuffer.useUuidIterator is false). Blocks if the number of pending bytes exceeds the maximum write-ahead or waitForPendingWrites() was called beforehand.
 */
protected void write(AsyncWriteBuffer writeBuffer) throws AddressToUUIDNotFoundException {
  assert(writeBuffer != null);
  if (writeBuffer.getDataLength() > maxWriteahead) {
    throw new XtreemFSException("String_Node_Str" + maxWriteahead + "String_Node_Str"+ writeBuffer.getDataLength());
  }
synchronized (this) {
    while (writingPaused || (pendingBytes + writeBuffer.getDataLength()) > maxWriteahead || writesInFlight.size() == maxWriteaheadRequests) {
      try {
        this.wait();
      }
 catch (      InterruptedException e) {
      }
    }
    increasePendingBytesHelper(writeBuffer);
  }
  String osdUuid=retrieveOSDUuidAndSetItInWriteBuffer(writeBuffer);
  String osdAddress=uuidResolver.uuidToAddress(osdUuid);
  InetSocketAddress osdInetSocketAddress=Helper.stringToInetSocketAddress(osdAddress,GlobalTypes.PORTS.OSD_PBRPC_PORT_DEFAULT.getNumber());
  final AsyncWriteBuffer finalWriteBufferForCallback=writeBuffer;
  RPCResponse<OSDWriteResponse> response;
  try {
    response=osdServiceClient.write(osdInetSocketAddress,authBogus,userCredentialsBogus,writeBuffer.getWriteRequest(),ReusableBuffer.wrap(writeBuffer.getData()));
    response.registerListener(new RPCResponseAvailableListener<OSDWriteResponse>(){
      @Override public void responseAvailable(      RPCResponse<OSDWriteResponse> r){
        try {
          OSDWriteResponse osdWriteResponse=r.get();
          writeFinished(osdWriteResponse,r.getData(),finalWriteBufferForCallback);
        }
 catch (        PBRPCException e) {
          String errorTypeName=e.getErrorType().toString();
          EnumValueDescriptor enumDescriptor=ErrorType.getDescriptor().findValueByNumber(e.getErrorType().getNumber());
          if (enumDescriptor != null) {
            errorTypeName=enumDescriptor.getName();
          }
          Logging.logMessage(Logging.LEVEL_ERROR,Category.misc,this,"String_Node_Str" + "String_Node_Str",finalWriteBufferForCallback.getOsdUuid(),errorTypeName,e.getErrorMessage(),e.getDebugInfo());
          System.out.println("String_Node_Str" + this.toString());
          decreasePendingBytesHelper(finalWriteBufferForCallback);
        }
catch (        Exception e) {
          Logging.logMessage(Logging.LEVEL_ERROR,Category.misc,this,"String_Node_Str" + "String_Node_Str",e.getMessage());
          decreasePendingBytesHelper(finalWriteBufferForCallback);
        }
 finally {
          r.freeBuffers();
        }
      }
    }
);
  }
 catch (  IOException e1) {
    Logging.logMessage(Logging.LEVEL_ERROR,Category.misc,this,"String_Node_Str" + "String_Node_Str",e1.getMessage());
    decreasePendingBytesHelper(finalWriteBufferForCallback);
  }
}

Fixed version (ground truth):
/** 
 * Adds writeBuffer to the list of pending writes and sends it to the OSD specified by writeBuffer.uuidIterator (or write_buffer.osdUuid if writeBuffer.useUuidIterator is false). Blocks if the number of pending bytes exceeds the maximum write-ahead or waitForPendingWrites() was called beforehand.
 */
protected void write(AsyncWriteBuffer writeBuffer) throws AddressToUUIDNotFoundException, XtreemFSException {
  assert(writeBuffer != null);
  if (writeBuffer.getDataLength() > maxWriteahead) {
    throw new XtreemFSException("String_Node_Str" + maxWriteahead + "String_Node_Str"+ writeBuffer.getDataLength());
  }
synchronized (this) {
    while (writingPaused || (pendingBytes + writeBuffer.getDataLength()) > maxWriteahead || writesInFlight.size() == maxWriteaheadRequests) {
      try {
        this.wait();
      }
 catch (      InterruptedException e) {
      }
    }
    increasePendingBytesHelper(writeBuffer);
  }
  String osdUuid=retrieveOSDUuidAndSetItInWriteBuffer(writeBuffer);
  String osdAddress=uuidResolver.uuidToAddress(osdUuid);
  InetSocketAddress osdInetSocketAddress=Helper.stringToInetSocketAddress(osdAddress,GlobalTypes.PORTS.OSD_PBRPC_PORT_DEFAULT.getNumber());
  final AsyncWriteBuffer finalWriteBufferForCallback=writeBuffer;
  RPCResponse<OSDWriteResponse> response;
  try {
    response=osdServiceClient.write(osdInetSocketAddress,authBogus,userCredentialsBogus,writeBuffer.getWriteRequest(),ReusableBuffer.wrap(writeBuffer.getData()));
    response.registerListener(new RPCResponseAvailableListener<OSDWriteResponse>(){
      @Override public void responseAvailable(      RPCResponse<OSDWriteResponse> r){
        try {
          OSDWriteResponse osdWriteResponse=r.get();
          writeFinished(osdWriteResponse,r.getData(),finalWriteBufferForCallback);
        }
 catch (        PBRPCException e) {
          String errorTypeName=e.getErrorType().toString();
          EnumValueDescriptor enumDescriptor=ErrorType.getDescriptor().findValueByNumber(e.getErrorType().getNumber());
          if (enumDescriptor != null) {
            errorTypeName=enumDescriptor.getName();
          }
          Logging.logMessage(Logging.LEVEL_ERROR,Category.misc,this,"String_Node_Str" + "String_Node_Str",finalWriteBufferForCallback.getOsdUuid(),errorTypeName,e.getErrorMessage(),e.getDebugInfo());
          System.out.println("String_Node_Str" + this.toString());
          decreasePendingBytesHelper(finalWriteBufferForCallback);
        }
catch (        Exception e) {
          Logging.logMessage(Logging.LEVEL_ERROR,Category.misc,this,"String_Node_Str" + "String_Node_Str",e.getMessage());
          decreasePendingBytesHelper(finalWriteBufferForCallback);
        }
 finally {
          r.freeBuffers();
        }
      }
    }
);
  }
 catch (  IOException e1) {
    Logging.logMessage(Logging.LEVEL_ERROR,Category.misc,this,"String_Node_Str" + "String_Node_Str",e1.getMessage());
    decreasePendingBytesHelper(finalWriteBufferForCallback);
  }
}