<div dir="ltr"><div dir="ltr">Hello!<div><br></div><div>The first of all, my erlang version OTP-21.3 (without any minor patches)</div><div><br></div><div>I've got the strange floating problem with UDP to receive, which I couldn't debug by myself. Let me describe briefly what I have: There is UDP socket which used for send packets to many peers and receives responses from them (rate ~1pps):</div><div><br></div><div>send request: SIP options</div><div>receive a response: 100</div><div>receive a response: 200</div><div><div><br></div><div>In erlang it's implemented like gen_server which receives messages, the sockets options are: <font face="monospace">binary, {active, once}</font>.</div><div><br></div><div>Every time, when the message is received from the mailbox, code try to do some job, after that try to handle message bursts by calling in the loop (by example 5 times):</div><div><code><span class="gmail-nn">gen_udp</span><span class="gmail-p">:</span><span class="gmail-nf">recv</span><span class="gmail-p">(</span><span class="gmail-nv">Socket</span><span class="gmail-p">,</span> <span class="gmail-mi">0</span><span class="gmail-p">,</span> <span class="gmail-mi">0</span><span class="gmail-p">), <font face="arial, sans-serif">bursts and after that set the socket option </font></span></code>{active, once} <span style="font-family:arial,sans-serif">back.</span></div><div><br></div><div>So, here I'm observing floating strange behavior, from time to time the second!! and always the second!! response is absent. I see this UDP missing packets in tcpdump, I don't see any drops in UDP stack at all.</div><div><br></div><div>When I'm trying to add some logs into my erlang code, the problem disappears, when I'm run <font face="monospace">strace</font> to <font face="monospace">recvfrom</font> syscall the problem disappears... I't try to debug VM with <font face="monospace">gdb</font> and make some breakpoints on <font face="monospace">sock_recvfrom</font> in <font face="monospace">inet_drv.c</font><font face="arial, sans-serif"> (it's OTP-<font color="#000000" style="background-color:rgb(255,255,255)"><span style="white-space:pre">21.</span><span class="gmail-x gmail-x-first gmail-x-last" style="box-sizing:border-box;border-radius:0.2em;white-space:pre">3), but </span></font></font>the problem disappears (((</div><div><br></div><div>I can't find the problem root cause, is it in my code or is it in VM? Maybe someone could help me with that? </div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr">Петровский Александр / Alexander Petrovsky,<br><br>Skype: askjuise<br><div>Phone: +7 931 9877991<div><br></div></div></div></div></div></div></div></div></div>