Copilot commented on code in PR #8847:
URL: https://github.com/apache/hadoop/pull/8847#discussion_r4398340767
##########
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/impl/BlockReaderFactory.java:
##########
@@ -622,6 +622,9 @@ private ShortCircuitReplicaInfo
requestFileDescriptors(DomainPeer peer,
// it's not a socket communication problem, we return null rather than
// throwing an exception.
LOG.warn("{}: error creating ShortCircuitReplica.", this, e);
+ if (slot != null) {
+ cache.freeSlot(slot);
+ }
Review Comment:
This path is reached after a successful `requestShortCircuitFds` response,
so the DataNode has already registered `slot`. `freeSlot` only removes the slot
from the client-side manager and, per its contract, is for slots the DataNode
does not yet know about; it does not send the release RPC. If
`ShortCircuitReplica` construction fails while the shared-memory segment has
other slots, the DataNode-side slot remains registered and leaks. Use the
normal `scheduleSlotReleaser(slot)` path here (or otherwise explicitly
unregister the slot on the DataNode), while retaining `freeSlot` for
response-error paths where the server unregisters it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]