<html><head></head><body><div class="ydpe3b55c7fyahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div></div>
        <div dir="ltr" data-setdir="false">We notice often using gen_tcp with sockets backend we get this warning printed:<br><br><span>3:24:4.923 <0.1018.0> [module: :gen_tcp_socket, socket: {:"$socket", #Reference<0.504347063.3068526593.55942>}, unknown_event: {:info, {:"$socket", {:"$socket", #Reference<0.504347063.3068526593.55942>}, :select, #Reference<0.504347063.3083599875.167918>}}, state: :connected]<br></span><br>Ignore the log format this is our custom format.<br><br>Seems to be some kinda race condition in the implementation.</div><div><br></div>
        
        </div><div id="yahoo_quoted_1991383206" class="yahoo_quoted">
            <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                
                <div>
                    On Friday, June 12, 2020, 09:30:07 a.m. EDT, pablo platt <pablo.platt@gmail.com> wrote:
                </div>
                <div><br></div>
                <div><br></div>
                <div><div id="yiv8181940438"><div><div dir="ltr"><div>Hi Raimo,</div><div><br clear="none"></div><div>I don't mind small changes in the API if changes will be indicated in the release notes.</div><div>But I worry about other breaking changes or hidden bugs.</div><div>If anyone from the community is already using it in production it will be reassuring.</div><div><br clear="none"></div><div>Thank you.<br clear="none"></div></div><br clear="none"><div class="yiv8181940438yqt0112590116" id="yiv8181940438yqt91641"><div class="yiv8181940438gmail_quote"><div class="yiv8181940438gmail_attr" dir="ltr">On Fri, Jun 12, 2020 at 4:00 PM Raimo Niskanen <<a rel="nofollow" shape="rect" ymailto="mailto:raimo%2Berlang-questions@erlang.org" target="_blank" href="mailto:raimo%2Berlang-questions@erlang.org">raimo+erlang-questions@erlang.org</a>> wrote:<br clear="none"></div><blockquote class="yiv8181940438gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;">Hi Pablo!<br clear="none">
<br clear="none">
We will still make backwards incompatible changes.  But we do not know of<br clear="none">
any stability issues, and welcome all that stress test the code.<br clear="none">
<br clear="none">
So your code might stop working work in a future 23.X release.<br clear="none">
<br clear="none">
/ Raimo<br clear="none">
<br clear="none">
<br clear="none">
On Fri, Jun 12, 2020 at 01:48:32PM +0300, pablo platt wrote:<br clear="none">
> Hi,<br clear="none">
> <br clear="none">
> Is it safe to use the NIF socket module for UDP in production in OTP 23?<br clear="none">
> It's working in my tests but I'm not sure if it's considered unstable or if<br clear="none">
> I'm missing configuration or error handling.<br clear="none">
> <br clear="none">
> This is how I'm using it:<br clear="none">
> <br clear="none">
> open() -><br clear="none">
>   {ok, Socket} = socket:open(inet, dgram, udp),<br clear="none">
>   {ok, Port} = socket:bind(Socket, any),<br clear="none">
>   {Socket, Port}.<br clear="none">
> <br clear="none">
> active_once(Socket) -><br clear="none">
>     case socket:recvfrom(Socket, 0, [], nowait) of<br clear="none">
>         {ok, {#{port := Port, addr := Addr}, Data}} -><br clear="none">
>             {udp, Addr, Port, Data};<br clear="none">
>         {select, {select_info, _SelectTag, SelectRef}} -><br clear="none">
>             SelectRef;<br clear="none">
>         {error, Reason} -><br clear="none">
>             exit(Reason),<br clear="none">
>             error<br clear="none">
>     end.<br clear="none">
> <br clear="none">
> send(Socket, Addr, Port, Data) -><br clear="none">
>     Dest = #{family => inet,<br clear="none">
>              port => Port,<br clear="none">
>              addr => Addr},<br clear="none">
>     case socket:sendto(Socket, Data, Dest, [], nowait) of<br clear="none">
>         ok -> ok;<br clear="none">
>         {select, {select_info, _SelectTag, _SelectRef}} -><br clear="none">
>             % need to wait for {'$socket', Socket, select, SelectRef}  and<br clear="none">
> resend Data?<br clear="none">
>             ok<br clear="none">
>     end.<br clear="none">
> <br clear="none">
> close(Socket) -><br clear="none">
>     socket:close(Socket).<br clear="none">
> <br clear="none">
> % listen for select ref<br clear="none">
> handle_info({'$socket', Socket, select, SelectRef}, _State) -><br clear="none">
>     case socket:recvfrom(Socket, 0, [], nowait) of<br clear="none">
>         {ok, {#{port := Port, addr := Addr}, Data}} -><br clear="none">
>             % handle Data<br clear="none">
>             ok;<br clear="none">
>         {select, {select_info, _SelectTag, SelectRef}} -><br clear="none">
>            SelectRef;<br clear="none">
>      {error, Reason} -><br clear="none">
>          exit(Reason),<br clear="none">
>          error<br clear="none">
>     end,<br clear="none">
>     {noreply, State}.<br clear="none">
<br clear="none">
-- <br clear="none">
<br clear="none">
/ Raimo Niskanen, Erlang/OTP, Ericsson AB<br clear="none">
</blockquote></div></div></div></div></div>
            </div>
        </div></body></html>