[erlang-patches] Fix port leaking after controlling_process(Port, self())

Ricardo Catalinas Jiménez <>
Sat Feb 4 16:55:10 CET 2012


I spotted the same issue that Max Lapshin reported in:

http://erlang.org/pipermail/erlang-questions/2011-April/057944.html


Add case to handle the situation when someone call
{gen_tcp,gen_udp}:controlling_process(Port, self()). Also improve spec
and doc from gen_udp and gen_sctp for controlling_process/2.

To reproduce the issue, open an UDP port:

4> {ok,Port} = gen_udp:open(9000, [binary]).
{ok,#Port<0.587>}
5> gen_udp:controlling_process(Port, self()).
ok

Simulate error:

6> 1=2.
** exception error: no match of right hand side value 2

Here is the leak:

7> inet:i().
Port Module   Recv Sent Owner    Local Address Foreign Address State
Type
581  inet_udp 0    0    <0.31.0> *:cslistener  *:*             BOUND
DGRAM
ok


Please fetch:
git fetch git://github.com/jimenezrick/otp.git fix-gen_udp_tcp-leak

Review here:
https://github.com/jimenezrick/otp/compare/erlang:maint...jimenezrick:fix-gen_udp_tcp-leak
https://github.com/jimenezrick/otp/compare/erlang:maint...jimenezrick:fix-gen_udp_tcp-leak.patch


Regards
-- 
Ricardo (http://r.untroubled.be/)


More information about the erlang-patches mailing list