[erlang-questions] Fwd: phantom ports in erlang:ports()

Björn-Egil Dahlberg wallentin.dahlberg@REDACTED
Tue Nov 13 22:01:59 CET 2012


2012/11/13 Patrik Nyblom <pan@REDACTED>

> Sounds like a bug allright.
>

Sounds like it yes ..

A couple of things. Ports needs to flush there io-queues before
terminating. If there is something in the queue when closing, the driver
callback for flush will be called.

If no such callback exists there might be trouble. In the case of tcp and
inets there exists a tcp_inet_flush and this is callback is invoked if the
queue is not empty.

So what drivers are used that doesn't have flush callbacks?

One exception to the flush mechanism should be exit(Port, kill). If the
exit signal 'kill' is received by the port, it should die no matter what.
(If I read the code correctly that is =)

// Björn-Egil



>
> Please send all relevant information, including platform, any special
> conditions (nif's, drivers whatnot) and any relevant logs etc to
> erlang_bugs or directly to me.
>
> Cheers,
> Patrik
>
>
> On 11/13/2012 12:35 PM, Tim Watson wrote:
>
>> Hi guys - can anyone answer this (below) please?
>>
>> Begin forwarded message:
>>
>>  From: Matthias Radestock <matthias@REDACTED>
>>> Subject: phantom ports in erlang:ports()
>>> Date: 12 November 2012 18:37:47 GMT
>>> To: erlang-questions@REDACTED
>>>
>>> I've got a customer system, running R15B02, which encountered
>>> system_limit errors when accepting tcp connections.
>>>
>>> 'lsof' indicates that there are just a few hundred file descriptors in
>>> use. However, erlang:ports() returns 1010 entries. For the majority of
>>> these ports:
>>> - erlang:port_info(Port) returns 'undefined'
>>> - port_close(Port) fails with 'badarg'
>>> - exit(Port, die) doesn't make them go away
>>>
>>> These ports have been in that state for days.
>>>
>>> Does anybody have any clue what's going on here?
>>>
>>> Is there any way to find out more about these ports? Looks like
>>> ctrl-c'ing in the emulator shell would allow me to get more info with the
>>> 'o' option. Unfortunately the customer's emulator is running detached, so
>>> that won't work.
>>>
>>> Regards,
>>>
>>> Matthias.
>>>
>> ______________________________**_________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/**listinfo/erlang-questions<http://erlang.org/mailman/listinfo/erlang-questions>
>>
>
> ______________________________**_________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/**listinfo/erlang-questions<http://erlang.org/mailman/listinfo/erlang-questions>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121113/1f5d09ea/attachment.htm>


More information about the erlang-questions mailing list