diff --git a/modules/dcache-webdav/src/main/java/org/dcache/webdav/transfer/RemoteTransferHandler.java b/modules/dcache-webdav/src/main/java/org/dcache/webdav/transfer/RemoteTransferHandler.java index c3e562b66d1..123a925dee1 100644 --- a/modules/dcache-webdav/src/main/java/org/dcache/webdav/transfer/RemoteTransferHandler.java +++ b/modules/dcache-webdav/src/main/java/org/dcache/webdav/transfer/RemoteTransferHandler.java @@ -692,8 +692,16 @@ public void messageArrived(CellMessage envelope, TransferCompleteMessage message } public void messageArrived(CellMessage envelope, TransferFailedMessage message) { + + LOGGER.error("TESTING ZERO_BYTE messageArrived 1 "); + messageArrived(Duration.of(envelope.getLocalAge(), MILLIS)); + + LOGGER.error("TESTING ZERO_BYTE messageArrived 2 " ); + RemoteTransfer transfer = _transfers.get(message.getId()); + LOGGER.error("TESTING ZERO_BYTE is transfer null " + transfer ); + if (transfer != null) { String error = String.valueOf(message.getErrorObject()); _activity.execute(() -> transfer.completed(error)); @@ -1114,6 +1122,8 @@ private void addDigestResponseHeader(FileAttributes attributes) { } private void completed(String transferError) { + LOGGER.error("TESTING ZERO_BYTE call completed id " + _id ); + if (_transfers.remove(_id) == null) { // Something else called complete, so do nothing. return; @@ -1127,6 +1137,8 @@ private void completed(String transferError) { fetchChecksums(); } else { if (_direction == Direction.PULL) { + LOGGER.error("TESTING ZERO_BYTE call deleteFile id " + _id ); + error = deleteFile() .map(e -> transferError + " (" + e + ")") .orElse(transferError); @@ -1157,6 +1169,8 @@ private Optional deleteFile() { * restrictions removed. */ PnfsHandler pnfs = new PnfsHandler(_pnfs, null); + LOGGER.error("TESTING ZERO_BYTE call deletePnfsEntry" ); + pnfs.deletePnfsEntry(_pnfsId, _path.toString(), EnumSet.of(FileType.REGULAR), EnumSet.noneOf(FileAttribute.class)); } catch (FileNotFoundCacheException e) { diff --git a/modules/dcache/src/main/java/diskCacheV111/services/TransferManager.java b/modules/dcache/src/main/java/diskCacheV111/services/TransferManager.java index d2dface8f80..3b9ea2f6b63 100644 --- a/modules/dcache/src/main/java/diskCacheV111/services/TransferManager.java +++ b/modules/dcache/src/main/java/diskCacheV111/services/TransferManager.java @@ -198,6 +198,7 @@ public void getInfo(PrintWriter pw) { public void messageArrived(DoorTransferFinishedMessage message) { long id = message.getId(); TransferManagerHandler h = getHandler(id); + LOGGER.error("TESTING ZERO_BYTE id is {}, handler is {} ", id, h ); if (h != null) { h.poolDoorMessageArrived(message); } @@ -359,6 +360,7 @@ public void addActiveTransfer(long id, TransferManagerHandler handler) { } public void removeActiveTransfer(long id) { + LOGGER.error("TESTING ZERO_BYTE removeActive transfer id {}", id); TransferManagerHandler handler = _activeTransfers.remove(id); if (handler == null) { return; diff --git a/modules/dcache/src/main/java/diskCacheV111/services/TransferManagerHandler.java b/modules/dcache/src/main/java/diskCacheV111/services/TransferManagerHandler.java index 54a1d94e141..633e949557b 100644 --- a/modules/dcache/src/main/java/diskCacheV111/services/TransferManagerHandler.java +++ b/modules/dcache/src/main/java/diskCacheV111/services/TransferManagerHandler.java @@ -333,6 +333,8 @@ public void success(Message message) { setState(RECEIVED_PNFS_ENTRY_DELETE); LOGGER.debug("Received PnfsDeleteEntryMessage, Deleted : {}", deleteReply.getPnfsPath()); + LOGGER.error("TESTING ZERO_BYTE Received PnfsDeleteEntryMessage, Deleted : {}", + deleteReply.getPnfsPath()); sendErrorReply(); } } @@ -588,11 +590,15 @@ public void deletePnfsEntry() { setState(WAITING_FOR_PNFS_ENTRY_DELETE); manager.persist(this); pnfsMsg.setReplyRequired(true); + LOGGER.error("TESTING ZERO_BYTE set RECEIVED_PNFS_CHECK_BEFORE_DELETE_STATE" ); + CellStub.addCallback(manager.getPnfsManagerStub().send(pnfsMsg), this, executor); } else { PnfsGetFileAttributes message = new PnfsGetFileAttributes(pnfsPath, EnumSet.noneOf(FileAttribute.class)); setState(WAITING_FOR_PNFS_CHECK_BEFORE_DELETE_STATE); + LOGGER.error("TESTING ZERO_BYTE set WAITING_FOR_PNFS_CHECK_BEFORE_DELETE_STATE" ); + CellStub.addCallback(manager.getPnfsManagerStub().send(message), this, executor); } } @@ -600,6 +606,8 @@ public void deletePnfsEntry() { public void poolDoorMessageArrived(DoorTransferFinishedMessage doorMessage) { LOGGER.debug("poolDoorMessageArrived, doorMessage.getReturnCode()={}", doorMessage.getReturnCode()); + LOGGER.error("TESTING ZERO_BYTE poolDoorMessageArrived, doorMessage.getReturnCode()={}", + doorMessage.getReturnCode()); if (doorMessage.getReturnCode() != 0) { sendErrorReply(CacheException.THIRD_PARTY_TRANSFER_FAILED, doorMessage.getErrorObject()); @@ -621,7 +629,12 @@ private void sendErrorReply(int replyCode, Serializable errorObject) { && created) {// Timur: I think this check is not needed, we might not ever get storage info and pnfs id: && pnfsId != null && aMetadata != null && aMetadata.getFileSize() == 0) { if (state != WAITING_FOR_PNFS_ENTRY_DELETE && state != RECEIVED_PNFS_ENTRY_DELETE) { LOGGER.debug("deleting pnfs entry we created: {}", pnfsPath); + LOGGER.error("TESTING ZERO_BYTE ptest store {}, created {}, state {}", + store, created, state); deletePnfsEntry(); + LOGGER.error("TESTING ZERO_BYTE afetre delete"); + LOGGER.error("TESTING ZERO_BYTE TEST THREAD " + Thread.currentThread().getName()); + return; } } @@ -648,8 +661,11 @@ private void sendErrorReply(int replyCode, Serializable errorObject) { } manager.finishTransfer(); try { + TransferFailedMessage errorReply = new TransferFailedMessage(transferRequest, replyCode, errorObject); + LOGGER.error("TESTING ZERO_BYTE TransferFailedMessage errorObject {}, errorObject {}", + errorObject,replyCode); manager.sendMessage(new CellMessage(requestor, errorReply)); } catch (RuntimeException e) { LOGGER.error("Send message failed:", e); @@ -657,6 +673,8 @@ private void sendErrorReply(int replyCode, Serializable errorObject) { } //this will allow the handler to be garbage collected // once we sent a response + LOGGER.error("TESTING ZERO_BYTE 1 removeActive transfer id {}", id); + manager.removeActiveTransfer(id); } @@ -691,6 +709,8 @@ private void sendErrorReply() { } manager.finishTransfer(); try { + LOGGER.error("TESTING ZERO_BYTE ind sendError without argumentsTransferFailedMessage errorObject {}, errorObject {}", + errorObject,replyCode); TransferFailedMessage errorReply = new TransferFailedMessage(transferRequest, replyCode, errorObject); manager.sendMessage(new CellMessage(requestor, errorReply)); @@ -700,6 +720,8 @@ private void sendErrorReply() { } //this will allow the handler to be garbage collected // once we sent a response + LOGGER.error("TESTING ZERO_BYTE 2 removeActive transfer id {}", id); + manager.removeActiveTransfer(id); } @@ -733,6 +755,8 @@ public void sendSuccessReply() { } //this will allow the handler to be garbage collected // once we sent a response + LOGGER.error("TESTING ZERO_BYTE 3 removeActive transfer id {}", id); + manager.removeActiveTransfer(id); } diff --git a/modules/dcache/src/main/java/diskCacheV111/util/PnfsHandler.java b/modules/dcache/src/main/java/diskCacheV111/util/PnfsHandler.java index b74da3f0646..b30314ddfe4 100644 --- a/modules/dcache/src/main/java/diskCacheV111/util/PnfsHandler.java +++ b/modules/dcache/src/main/java/diskCacheV111/util/PnfsHandler.java @@ -4,6 +4,7 @@ import static org.dcache.namespace.FileAttribute.PNFSID; import static org.dcache.namespace.FileType.DIR; import static org.dcache.namespace.FileType.LINK; +import static org.dcache.qos.QoSTransitionEngine.LOGGER; import com.google.common.util.concurrent.ListenableFuture; import diskCacheV111.namespace.NameSpaceProvider.Link; @@ -386,6 +387,8 @@ public void deletePnfsEntry(PnfsId pnfsid, String path) public FileAttributes deletePnfsEntry(PnfsId pnfsid, String path, Set allowed, Set attr) throws CacheException { + LOGGER.error("TESTING ZERO_BYTE call deletePnfsEntry send request" ); + return request(new PnfsDeleteEntryMessage(pnfsid, path, allowed, attr)).getFileAttributes(); }