Skip to content

Commit

Permalink
ftp: Fix race that lead to erroneous error message in log file
Browse files Browse the repository at this point in the history
Removes the following error message:

05 dec 2013 14:35:34 (httpd) [door:httpd@dCacheDomain:1386250529077 door:httpd@dCacheDomain:1386250530581 door:httpd@dCacheDomain:1386250530980 door:httpd@dCacheDomain:13
86250531049 door:httpd@dCacheDomain:1386250531677 door:httpd@dCacheDomain:1386250531744 door:httpd@dCacheDomain:1386250533468 door:httpd@dCacheDomain:1386250533660 door:h
ttpd@dCacheDomain:1386250534760] Cannot abort transfer that already completed: 451 Aborting transfer due to session termination

This error is a result of a race in which door shutdown and
the transfer termination sequence conincide. The patch
rearranges the termination sequence to mark the transfer
as completed before providing the final reply to the client.
The patch also removes the error logging.

Target: trunk
Require-notes: no
Require-book: no
Acked-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
Patch: http://rb.dcache.org/r/6320/
  • Loading branch information
gbehrmann committed Dec 9, 2013
1 parent 25e91f9 commit d885e74
Showing 1 changed file with 3 additions and 9 deletions.
Expand Up @@ -1088,9 +1088,9 @@ protected synchronized void transferCompleted(CacheException error)
}

notifyBilling(0, "");
reply("226 Transfer complete.");
_completed = true;
setTransfer(null);
reply("226 Transfer complete.");
} catch (CacheException e) {
abort(426, e.getMessage());
} catch (FTPCommandException e) {
Expand Down Expand Up @@ -1128,13 +1128,7 @@ public void abort(int replyCode, String msg)
public synchronized void abort(int replyCode, String replyMsg,
Exception exception)
{
if (_aborted) {
return;
}

if (_completed) {
LOGGER.error("Cannot abort transfer that already completed: {} {}",
replyCode, replyMsg);
if (_aborted || _completed) {
return;
}

Expand Down Expand Up @@ -1172,9 +1166,9 @@ public synchronized void abort(int replyCode, String replyMsg,
LOGGER.error("Transfer error: {} ({})", msg, exception.getMessage());
LOGGER.debug(exception.toString(), exception);
}
reply(msg);
_aborted = true;
setTransfer(null);
reply(msg);
}
}

Expand Down

0 comments on commit d885e74

Please sign in to comment.