@abh3 : could you put some light on how endsess is handled on the server side?

On the client side when there is a stream timeout, the original connection gets closed, and then a new connection is opened. Once the connection is established a handshake happens, the last part of the handshake is the kXR_endsess request that is supposed to terminate the pre-existing connection. The "second open" from Steve/Eric's scenario is guaranteed to happen after the client receives the response to the kXR_endsess request.

I noticed in the XrdXrootdProtocol::do_Endsess():

// Extract out the FD and Instance from the session ID
//
   sp = (XrdXrootdSessID *)Request.endsess.sessid;
   memcpy((void *)&sessID.Pid,  &sp->Pid,  sizeof(sessID.Pid));
   memcpy((void *)&sessID.FD,   &sp->FD,   sizeof(sessID.FD));
   memcpy((void *)&sessID.Inst, &sp->Inst, sizeof(sessID.Inst));

// Trace this request
//
   TRACEP(LOGIN, "endsess " <<sessID.Pid <<':' <<sessID.FD <<'.' <<sessID.Inst);

// If this session id does not refer to us, ignore the request
//
   if (sessID.Pid != myPID) return Response.Send();

// Terminate the indicated session, if possible. This could also be a self-termination.
//
   if ((sessID.FD == 0 && sessID.Inst == 0) 
   ||  !(rc = Link->Terminate(Link, sessID.FD, sessID.Inst))) return -1;

and then further in XrdLink::Terminate(...):

// We can now disable the link and schedule a close
//
   snprintf(buff, sizeof(buff), "ended by %s", ID);
   buff[sizeof(buff)-1] = '\0';
   lp->Poller->Disable(lp, buff);
   lp->opMutex.UnLock();

// Now wait for the link to shutdown. This avoids lock problems.
//
   if (killDone.Wait(int(killWait))) wTime += killWait;
      else wTime = -EPIPE;
   killDone.UnLock();

At a first glance it seems to me that the server will terminate the original connection while handling the kXR_endsess request. Could you comment on that?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/xrootd/xrootd","title":"xrootd/xrootd","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/xrootd/xrootd"}},"updates":{"snippets":[{"icon":"PERSON","message":"@simonmichal in #673: @abh3 : could you put some light on how endsess is handled on the server side?\r\n\r\nOn the client side when there is a stream timeout, the original connection gets closed, and then a new connection is opened. Once the connection is established a handshake happens, the last part of the handshake is the kXR_endsess request that is supposed to terminate the pre-existing connection. The \"second open\" from Steve/Eric's scenario is guaranteed to happen after the client receives the response to the kXR_endsess request.\r\n\r\nI noticed in the XrdXrootdProtocol::do_Endsess():\r\n```\r\n// Extract out the FD and Instance from the session ID\r\n//\r\n sp = (XrdXrootdSessID *)Request.endsess.sessid;\r\n memcpy((void *)\u0026sessID.Pid, \u0026sp-\u003ePid, sizeof(sessID.Pid));\r\n memcpy((void *)\u0026sessID.FD, \u0026sp-\u003eFD, sizeof(sessID.FD));\r\n memcpy((void *)\u0026sessID.Inst, \u0026sp-\u003eInst, sizeof(sessID.Inst));\r\n\r\n// Trace this request\r\n//\r\n TRACEP(LOGIN, \"endsess \" \u003c\u003csessID.Pid \u003c\u003c':' \u003c\u003csessID.FD \u003c\u003c'.' \u003c\u003csessID.Inst);\r\n\r\n// If this session id does not refer to us, ignore the request\r\n//\r\n if (sessID.Pid != myPID) return Response.Send();\r\n\r\n// Terminate the indicated session, if possible. This could also be a self-termination.\r\n//\r\n if ((sessID.FD == 0 \u0026\u0026 sessID.Inst == 0) \r\n || !(rc = Link-\u003eTerminate(Link, sessID.FD, sessID.Inst))) return -1;\r\n```\r\nand then further in XrdLink::Terminate(...):\r\n```\r\n// We can now disable the link and schedule a close\r\n//\r\n snprintf(buff, sizeof(buff), \"ended by %s\", ID);\r\n buff[sizeof(buff)-1] = '\\0';\r\n lp-\u003ePoller-\u003eDisable(lp, buff);\r\n lp-\u003eopMutex.UnLock();\r\n\r\n// Now wait for the link to shutdown. This avoids lock problems.\r\n//\r\n if (killDone.Wait(int(killWait))) wTime += killWait;\r\n else wTime = -EPIPE;\r\n killDone.UnLock();\r\n```\r\n\r\nAt a first glance it seems to me that the server will terminate the original connection while handling the kXR_endsess request. Could you comment on that?"}],"action":{"name":"View Issue","url":"https://github.com/xrootd/xrootd/issues/673#issuecomment-375007957"}}}

Use REPLY-ALL to reply to list

To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1