[erlang-questions] gen_udp port leaking after controlling_process(Port, self())
Max Lapshin
max.lapshin@REDACTED
Wed Apr 27 19:05:06 CEST 2011
Open UDP port
$ erl
Erlang R14B02 (erts-5.8.3) [source] [64-bit] [smp:4:4] [rq:4]
[async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.8.3 (abort with ^G)
1> {ok,Port} = gen_udp:open(9000, [binary]).
{ok,#Port<0.576>}
$ lsof -nP -i|grep beam|grep UDP
beam.smp 10912 max 11u IPv4 0x089073c4 0t0 UDP *:9000
Simulate error:
2> a=b.
** exception error: no match of right hand side value b
All ports are closed.
$ lsof -nP -i|grep beam|grep UDP
$
Now add controlling_process:
4> {ok,Port} = gen_udp:open(9000, [binary]).
{ok,#Port<0.587>}
5> gen_udp:controlling_process(Port, self()).
ok
6> a=b.
** exception error: no match of right hand side value b
Voila: port is not closed
lsof -nP -i|grep beam|grep UDP
beam.smp 10912 max 11u IPv4 0x089073c4 0t0 UDP *:9000
Where is it? To which process belongs it now and when will it be closed?
More information about the erlang-questions
mailing list