Skip to content

Commit

Permalink
[XrdCl] Avoid race by using TimeOutSID in single place
Browse files Browse the repository at this point in the history
  • Loading branch information
David Smith committed Aug 16, 2022
1 parent 25e600b commit c107f88
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/XrdCl/XrdClXRootDMsgHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -827,8 +827,7 @@ namespace XrdCl
log->Debug( XRootDMsg, "[%s] Wait time is too long, timing out %s",
pUrl.GetHostId().c_str(),
pRequest->GetDescription().c_str() );
pStatus = Status( stError, errOperationExpired );
HandleResponse();
HandleError( Status( stError, errOperationExpired) );
}
return;
}
Expand Down Expand Up @@ -890,14 +889,6 @@ namespace XrdCl
if( pTimeoutFence.load( std::memory_order_relaxed ) )
return 0;

if( pSidMgr && pMsgInFly && ( event == Timeout
|| status.code == errOperationExpired
|| status.code == errOperationInterrupted ) )
{
ClientRequest *req = (ClientRequest *)pRequest->GetBuffer();
pSidMgr->TimeOutSID( req->header.streamid );
}

HandleError( status );
return RemoveHandler;
}
Expand Down Expand Up @@ -1189,10 +1180,8 @@ namespace XrdCl
if( pSidMgr && finalrsp )
{
ClientRequest *req = (ClientRequest *)pRequest->GetBuffer();
if( !status->IsOK() && pMsgInFly &&
( status->code == errOperationExpired || status->code == errOperationInterrupted ) )
pSidMgr->TimeOutSID( req->header.streamid );
else
if( status->IsOK() || !pMsgInFly ||
!( status->code == errOperationExpired || status->code == errOperationInterrupted ) )
pSidMgr->ReleaseSID( req->header.streamid );
}

Expand Down Expand Up @@ -2001,6 +1990,14 @@ namespace XrdCl
if( status.IsOK() )
return;

if( pSidMgr && pMsgInFly && (
status.code == errOperationExpired ||
status.code == errOperationInterrupted ) )
{
ClientRequest *req = (ClientRequest *)pRequest->GetBuffer();
pSidMgr->TimeOutSID( req->header.streamid );
}

bool noreplicas = ( status.code == errErrorResponse &&
status.errNo == kXR_noReplicas );

Expand Down

0 comments on commit c107f88

Please sign in to comment.