Repository navigation
Conversation
Motivation: The remote-HTTP mover copies the GET response body with HttpEntity#writeTo. If the copy fails, for example because the mover was cancelled (FTS "client went away", TransferManager timeout, mover kill) and the write to the replica throws ClosedByInterruptException, writeTo closes the content stream, and closing it reads the rest of the body from the remote server. This blocking read is not stopped by the interrupt. The mover stays in CANCELED state until the whole file has arrived, holds an HTTP-TPC connection slot, and cannot be killed. On a slow WAN path these movers fill the connection pool and new transfers wait for a connection. Modification: The mover copies the body from the entity's content stream itself and does not close the stream if the copy fails. RemoteHttpTransferClient#get aborts the GET request if the body receiver throws, so the connection is shut down instead of being read to the end or reused. This also covers the per-transfer client used with X.509 delegation, which is closed only after get returns, and the WebDAV door when it proxies a pull. Result: A cancelled HTTP-TPC pull ends promptly and releases its connection. Target: master, 12.0, 11.2 Require-book: no Require-notes: yes Fixes: dCache#8301 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Geonmo Ryu <geonmo@kisti.re.kr>
geonmo
added a commit
to geonmo/dcache-gsdc
that referenced
this pull request
Nov 26, 2026
…dCache/dcache#8327) Backport of dCache/dcache#8327 (fixes dCache/dcache#8301) to 11.2: a cancelled HTTP-TPC pull no longer reads the rest of the remote body and releases its connection slot. The change is in dcache-core, which is already in container/overlay.txt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X3vgU2Uiah5GhGtrhNt391
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8301.
Problem
The remote-HTTP mover copies the GET response body with
HttpEntity#writeTo. When the copy fails (for example the mover is cancelled and the replica write throwsClosedByInterruptException),BasicHttpEntity#writeTocloses the content stream infinally, andContentLengthInputStream#close()reads the rest of the body from the remote server. That blocking read is not stopped by the interrupt. The mover staysCANCELEDuntil the whole file has arrived, holds an HTTP-TPC connection slot, andmover killdoes not remove it. On slow WAN paths these movers fillpool.mover.http-tpc.connections.max, and new transfers wait for a connection.Change
RemoteHttpDataTransferProtocolcopies the body fromentity.getContent()itself and does not close the stream when the copy fails.RemoteHttpTransferClient#getaborts the GET request if the body receiver throws, so the connection is shut down instead of being drained or reused. This also covers the per-transfer client used with X.509 delegation (closed only aftergetreturns) and the WebDAV door when it proxies a pull.Tests
RemoteHttpTransferClientTest: a local HTTP server announces 1 MB and sends 17 bytes; when the receiver fails or is interrupted the request is aborted; a complete body is not aborted.RemoteHttpDataTransferProtocolTest: the whole body is copied; on a write or read failure the body is neither drained nor closed.mvn -pl modules/dcache install: 1304 tests, 0 failures.Not covered
If the remote server sends nothing at all, cancelling the mover still waits for the next data or the socket timeout before the request is aborted; there is no cancel hook in
MoverProtocolother than the interrupt. The reported symptom, reading the rest of the body to the end, is fixed.Backport
11.2 has no
org.dcache.http.tpcpackage (the GET is done inRemoteHttpDataTransferProtocol), so the change will not cherry-pick as is; the same two steps apply there.🤖 Generated with Claude Code