<div dir="ltr">Hello,<br><div class="gmail_extra"><br></div><div class="gmail_extra">The port seems to have gotten stuck while flushing it's output to stdout. When a port is flushing, it is invalid to interact with (as you see through the badarg you get from port_close), but it still shows up in erlang:ports() as it is not completely gone yet.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Since you are using run_erl, it seems like for some reason that program is not reading from the dup:ed stdout fd. Does the syslog/run_erl log tell you anything about what may be going on there?</div><div class="gmail_extra"><br></div><div class="gmail_extra">Lukas</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 8, 2017 at 10:55 AM, 叶少波 <span dir="ltr"><<a href="mailto:ye02@163.com" target="_blank">ye02@163.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Hi erlang expets,</div><div><br></div><div>I met a problem about the erlang port "tty_sl -c- e".</div><div><br></div><div>The scenario is like this:</div><div>1) I start two erlang nodes (Lets say one is Node1, another one is Node2) by run_erl, they are connected together.</div><div> I can login to these two nodes by to_erl and do anythings on the erlang shell. It run very well.</div><div><br></div><div>2) But today I tried to use to_erl to login to the Node1, I can`t type anything on the shell, it seems the shell is hanging;</div><div> Then I login to the Node2 and run rpc:call(node1, shell, start, []) to start a new shell on Node1, and I check the port </div><div> info of the port "tty_sl -c -e", it shows below:</div><div><div><span style="color:rgb(255,0,0)">(node1@servicer_3_1)7> Port.</span></div><div><span style="color:rgb(255,0,0)">#Port<0.4832> </span></div><div><span style="color:rgb(255,0,0)">(node1@servicer_3_1)8> erlang:port_info(Port).</span></div><div><span style="color:rgb(255,0,0)">[{name,"tty_sl -c -e"}, </span></div><div><span style="color:rgb(255,0,0)"> {links,[]}, </span></div><div><span style="color:rgb(255,0,0)"> {id,38656},</span></div><div><font color="#ff0000"> {connected,<0.1502.0>}, </font></div><div><span style="color:rgb(255,0,0)"> {input,2552},</span></div><div><span style="color:rgb(255,0,0)"> {output,1751871},</span></div><div><span style="color:rgb(255,0,0)"> {os_pid,undefined}]</span></div></div><div><span style="color:rgb(255,0,0)"><br></span></div><div>you can see here, the "links" is empty and the connected process does`t exist.</div><div><div><span style="color:rgb(255,0,0)">(node1@servicer_3_1)3> erlang:process_info(pid(0, 1502, 0)).</span></div><div><span style="color:rgb(255,0,0)">undefined </span></div></div><div><span style="color:rgb(255,0,0)"><br></span></div><div><font color="#ff0000"><span style="color:rgb(0,0,0)">3) I tried to close the port by erlang:port_close(Port), the result is as below:</span></font></div><div><div><span style="color:rgb(255,0,0)">(titan1_ps3@servicer_3_1)4> erlang:port_close(Port).</span></div><div><span style="color:rgb(255,0,0)">** exception error: bad argument</span></div><div><span style="color:rgb(255,0,0)"> in function port_close/1</span></div><div><span style="color:rgb(255,0,0)"> called as port_close(#Port<0.4832>)</span></div></div><div><span style="color:rgb(255,0,0)"><br></span></div><div>It seems the port already died.</div><div><font color="#ff0000"><span style="color:rgb(0,0,0)">As I know, the port will be closed if the linked process dies. But here we can see the port does`t exit. </span></font></div><div><font color="#ff0000"><span style="color:rgb(0,0,0)">Do you know what is the reason? Or how can I kill the port?</span></font></div><div><font color="#ff0000"><br></font></div><div><font color="#ff0000"><span style="color:rgb(0,0,0)">Actually I met this problem several times before, I had to reboot the</span></font> node the fix.</div><div><br></div><div><font color="#ff0000"><span style="color:rgb(0,0,0)">Thanks,</span></font></div><div><font color="#ff0000"><span style="color:rgb(0,0,0)">BRs/Michael</span></font></div></div><br><br><span title="neteasefooter"><p> </p></span><br>______________________________<wbr>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/<wbr>listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div></div>