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

Lukas Larsson lukas@REDACTED
Wed Mar 14 10:11:29 CET 2012


Hello!

The fix looks fine. Could you also add a testcase to gen_tcp_misc_SUITE 
which verifies this? As soon as that is added we'll merge it upstream.

Lukas

On 04/02/12 16:55, Ricardo Catalinas Jiménez wrote:
> 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



More information about the erlang-patches mailing list