[erlang-questions] Port is included in erlang:ports(), but erlang:port_info(Port) returnes 'undefined'

Patrik Nyblom pan@REDACTED
Thu Mar 28 12:01:57 CET 2013


Hi!

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...)

Cheers,
/Patrik

On 03/19/2013 04:36 PM, skyman wrote:
> Hi everyone,
> I encounter a problem:
> While server socket is sending packets, client socket closes, then I 
> find the socket's send_pend( inet:getstat(Socket, [send_pend]) ) is 
> always > 0, that is some data isn't sent out. After closing the port, 
> I find the port 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 erlang:ports() and 
> erlang:port_info() are inconsistent. The code:
>
> void erts_do_exit_port(Port *p, Eterm from, Eterm reason)
> {
>    ...
>    if ((reason != am_kill) && !is_port_ioq_empty(p)) {
>        erts_port_status_bandor_set(p,
> ~ERTS_PORT_SFLG_EXITING, /* must turn it off */
> ERTS_PORT_SFLG_CLOSING);
>       flush_port(p);
>    }
>    ...
> }
>
> The problem can only exist with TCP option: {delay_send, true}. When 
> set {delay_send, false}, the problem disappears.
>
> In addition, on this occasion erlang:halt() cannot terminate the node, 
> have to use erlang:halt(Status, [{flush,false}]).
>
> Can anyone help me? Thanks in advance!
>
>
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130328/062d4173/attachment.htm>


More information about the erlang-questions mailing list