<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi!<br>
      <br>
      Sure looks like a bug to me... Thanks for finding it! Could you
      repost on erlang-bugs? (You need to register for that list as
      well...)<br>
      <br>
      Cheers,<br>
      /Patrik<br>
      <br>
      On 03/19/2013 04:36 PM, skyman wrote:<br>
    </div>
    <blockquote
      cite="mid:7cefc809.103ee.13d834b9756.Coremail.cloudzen@163.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <div
        style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"><font
          size="3">Hi everyone,</font>
        <div style="font-size: 16px;">I encounter a problem:</div>
        <div><font size="3">While server socket is sending</font><font
            style="font-size: 16px;" face="Verdana, Arial, Helvetica,
            sans-serif" size="3"><span style="line-height: normal;"> packets,
              client socket closes, then I find the socket's send_pend(
              inet:getstat(Socket, [send_pend]</span></font><span
            style="font-size: 16px; line-height: normal; font-family:
            Verdana, Arial, Helvetica, sans-serif;">) ) is always >
            0, that is some data isn't sent out. After closing the port,
            I find the p</span><font face="Verdana, Arial, Helvetica,
            sans-serif" size="3"><span style="line-height: normal;">ort
              is still included in erlang:ports(), but
              erlang:port_info(Port) returnes 'undefined'. I guess that
              because the port's send queue is not empty, the erts set
              the port's status to be ERTS_PORT_SFLG_CLOSING, so th e
              results between </span></font><span style="font-family:
            Verdana, Arial, Helvetica, sans-serif; font-size: medium;
            line-height: normal;">erlang:ports() and </span><span
            style="font-family: Verdana, Arial, Helvetica, sans-serif;
            font-size: medium; line-height: normal;">erlang:port_info()
            are </span><font face="Verdana, Arial, Helvetica,
            sans-serif" size="3"><span style="line-height: normal;">inconsistent.
              The code:</span></font></div>
        <div><font face="Verdana, Arial, Helvetica, sans-serif" size="3"><span
              style="line-height: normal;"><br>
            </span></font></div>
        <div><font face="Verdana, Arial, Helvetica, sans-serif" size="3"><span
              style="line-height: normal;">
              <div>void erts_do_exit_port(Port *p, Eterm from, Eterm
                reason)</div>
              <div>{</div>
              <div>   ...</div>
              <div>   if ((reason != am_kill) &&
                !is_port_ioq_empty(p)) {</div>
              <div>       erts_port_status_bandor_set(p,</div>
              <div>                                       
                ~ERTS_PORT_SFLG_EXITING, /* must turn it off */</div>
              <div>                                       
                ERTS_PORT_SFLG_CLOSING);</div>
              <div>      flush_port(p);</div>
              <div>   }</div>
              <div>   ...</div>
              <div>}</div>
              <div><br>
              </div>
              <div>The problem can only exist with TCP
                option: {delay_send, true}. When set {delay_send,
                false}, the problem disappears.</div>
            </span></font><font face="Verdana, Arial, Helvetica,
            sans-serif" size="3"><span style="line-height: normal;">
              <div><br>
              </div>
              <div>In addition, on this occasion erlang:halt() cannot
                terminate the node, have to use erlang:halt(Status,
                [{flush,false}]).</div>
              <div><br>
              </div>
              <div>Can anyone help me? Thanks in advance!</div>
            </span></font></div>
        <div><span style="line-height: normal; font-family: Verdana, Ar
            ial, Helvetica, sans-serif; font-size: medium;"></span></div>
        <div><br>
        </div>
      </div>
      <br>
      <br>
      <span title="neteasefooter"><span id="netease_mail_footer"></span></span>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
erlang-questions mailing list
<a class="moz-txt-link-abbreviated" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>