<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Hirak<o:p></o:p>,<br>
    <br>
    In your scenario, the hanging on the client side is not a bug (but
    yes, it is not user-friendly).<br>
    <br>
    Here is the description about MPI_Comm_connect in the MPI 3.0
    standard.<br>
    <blockquote type="cite">
      
      <div class="page" title="Page 421">
        <div class="layoutArea">
          <div class="column">
            <p><span style="font-size: 11.000000pt; font-family:
                'CMR10'">If the named port does not exist (or has been
                closed), </span><span style="font-size: 11.000000pt;
                font-family: 'CMSS10'">MPI</span><span style="font-size:
                11.000000pt; font-family: 'CMTT10'">_</span><span style="font-size: 11.000000pt; font-family: 'CMSS10'">COMM</span><span style="font-size: 11.000000pt; font-family: 'CMTT10'">_</span><span style="font-size: 11.000000pt; font-family: 'CMSS10'">CONNECT
              </span><span style="font-size: 11.000000pt; font-family:
                'CMR10'">raises
                an error of class </span><span style="font-size:
                10.000000pt; font-family: 'CMSS10'">MPI</span><span style="font-size: 10.000000pt; font-family: 'CMTT10'">_</span><span style="font-size: 10.000000pt; font-family: 'CMSS10'">ERR</span><span style="font-size: 10.000000pt; font-family: 'CMTT10'">_</span><span style="font-size: 10.000000pt; font-family: 'CMSS10'">PORT</span><span style="font-size: 11.000000pt; font-family: 'CMR10'">.
              </span></p>
          </div>
        </div>
      </div>
    </blockquote>
    > run_good in your example.<br>
    <blockquote type="cite">
      <div class="page" title="Page 421">
        <div class="layoutArea">
          <div class="column">
            <p><span style="font-size: 11.000000pt; font-family:
                'CMR10'">If the port exists, but does not have a pending
              </span><span style="font-size: 11.000000pt; font-family:
                'CMSS10'">MPI</span><span style="font-size: 11.000000pt;
                font-family: 'CMTT10'">_</span><span style="font-size:
                11.000000pt; font-family: 'CMSS10'">COMM</span><span style="font-size: 11.000000pt; font-family: 'CMTT10'">_</span><span style="font-size: 11.000000pt; font-family: 'CMSS10'">ACCEPT</span><span style="font-size: 11.000000pt; font-family: 'CMR10'">,
                the connection
                attempt will eventually time out after an
                implementation-defined time, or succeed when
                the server calls </span><span style="font-size:
                11.000000pt; font-family: 'CMSS10'">MPI</span><span style="font-size: 11.000000pt; font-family: 'CMTT10'">_</span><span style="font-size: 11.000000pt; font-family: 'CMSS10'">COMM</span><span style="font-size: 11.000000pt; font-family: 'CMTT10'">_</span><span style="font-size: 11.000000pt; font-family: 'CMSS10'">ACCEPT</span><span style="font-size: 11.000000pt; font-family: 'CMR10'">.
                In the case of a time out, </span><span style="font-size: 11.000000pt; font-family: 'CMSS10'">MPI</span><span style="font-size: 11.000000pt; font-family: 'CMTT10'">_</span><span style="font-size: 11.000000pt; font-family: 'CMSS10'">COMM</span><span style="font-size: 11.000000pt; font-family: 'CMTT10'">_</span><span style="font-size: 11.000000pt; font-family: 'CMSS10'">CONNECT
              </span><span style="font-size: 11.000000pt; font-family:
                'CMR10'">raises an error of class </span><span style="font-size: 10.000000pt; font-family: 'CMSS10'">MPI</span><span style="font-size: 10.000000pt; font-family: 'CMTT10'">_</span><span style="font-size: 10.000000pt; font-family: 'CMSS10'">ERR</span><span style="font-size: 10.000000pt; font-family: 'CMTT10'">_</span><span style="font-size: 10.000000pt; font-family: 'CMSS10'">PORT</span><span style="font-size: 11.000000pt; font-family: 'CMR10'">.
              </span></p>
          </div>
        </div>
      </div>
    </blockquote>
    
    <title>MPI: A Message-Passing Interface Stand</title>
    > This is the run_bad case, the "<span style="font-size:
      11.000000pt; font-family: 'CMR10'">eventually time out</span>" is
    implementation dependent
    <title>: A Message-Passing Interface Standard</title>
    . However, I just glanced over the code, it seems MPICH currently
    does not handle user-specified timeout through the info argument. I
    will look into code and keep you updated.<br>
    <br>
    Min<br>
    <br>
    <div class="moz-cite-prefix">On 5/11/16 11:39 PM, Roy, Hirak wrote:<br>
    </div>
    <blockquote cite="mid:8B38871795FD7042B826C1D1670246FB0122313380@EU-MBX-01.mgc.mentorg.com" type="cite">
      
      <meta name="Generator" content="Microsoft Word 14 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:402413314;
        mso-list-type:hybrid;
        mso-list-template-ids:-384169478 138321160 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-text:%1>;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l1
        {mso-list-id:453138730;
        mso-list-type:hybrid;
        mso-list-template-ids:-1938127276 1197906800 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l1:level1
        {mso-level-text:%1>;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l1:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l1:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal">Hi mpich team,<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">I am using MPICH 3.0.4 sock with dynamic
          connection (accept/connect).<o:p></o:p></p>
        <p class="MsoNormal">I am facing issues with the following
          scenario, when there is a race condition in MPI_Comm_connect.<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Here is the case <o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l1 level1 lfo1"><!--[if !supportLists]--><span style="mso-list:Ignore">1><span style="font:7.0pt
              "Times New Roman"">   
            </span></span><!--[endif]-->Server opens a port, writes the
          port info in a file, calls MPI_Comm_accept<o:p></o:p></p>
        <p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l1 level1 lfo1"><!--[if !supportLists]--><span style="mso-list:Ignore">2><span style="font:7.0pt
              "Times New Roman"">   
            </span></span><!--[endif]-->Client1 & Client2 reads the
          port information from file and each client calls
          MPI_Comm_connect<o:p></o:p></p>
        <p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l1 level1 lfo1"><!--[if !supportLists]--><span style="mso-list:Ignore">3><span style="font:7.0pt
              "Times New Roman"">   
            </span></span><!--[endif]-->Server accepts one client,
          disconnects, closes the port, exit<o:p></o:p></p>
        <p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l1 level1 lfo1"><!--[if !supportLists]--><span style="mso-list:Ignore">4><span style="font:7.0pt
              "Times New Roman"">   
            </span></span><!--[endif]-->One of the client successfully
          connects, disconnects, exit<o:p></o:p></p>
        <p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l1 level1 lfo1"><!--[if !supportLists]--><span style="mso-list:Ignore">5><span style="font:7.0pt
              "Times New Roman"">   
            </span></span><!--[endif]-->The other client hangs in
          MPI_Comm_connect<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">If you do the following steps, you can
          reproduce the issue<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l0 level1 lfo2"><!--[if !supportLists]--><span style="mso-list:Ignore">1><span style="font:7.0pt
              "Times New Roman"">   
            </span></span><!--[endif]-->Please set compiler and
          installation path of MPICH in makefile<o:p></o:p></p>
        <p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l0 level1 lfo2"><!--[if !supportLists]--><span style="mso-list:Ignore">2><span style="font:7.0pt
              "Times New Roman"">   
            </span></span><!--[endif]-->make : compiles<o:p></o:p></p>
        <p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l0 level1 lfo2"><!--[if !supportLists]--><span style="mso-list:Ignore">3><span style="font:7.0pt
              "Times New Roman"">   
            </span></span><!--[endif]-->make run_bad<o:p></o:p></p>
        <p class="MsoListParagraph"><o:p> </o:p></p>
        <p class="MsoNormal">I have noticed that in case client calls
          MPI_Comm_connect after the port is closed, the connect calls
          successfully terminates with error (make run_good).<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Please let me know whether it is a bug or
          not.<o:p></o:p></p>
        <p class="MsoNormal">Please also let me know if the connect call
          can be configured with a timeout or not.<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Thanks,<o:p></o:p></p>
        <p class="MsoNormal">Hirak<o:p></o:p></p>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
discuss mailing list     <a class="moz-txt-link-abbreviated" href="mailto:discuss@mpich.org">discuss@mpich.org</a>
To manage subscription options or unsubscribe:
<a class="moz-txt-link-freetext" href="https://lists.mpich.org/mailman/listinfo/discuss">https://lists.mpich.org/mailman/listinfo/discuss</a></pre>
    </blockquote>
    <br>
  </body>
</html>