<div dir="ltr"><div dir="ltr">Am Di., 4. Feb. 2020 um 14:35 Uhr schrieb Alexander Petrovsky <<a href="mailto:askjuise@gmail.com">askjuise@gmail.com</a>>:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Paul, thank you for your quick response, it seems like I'm was not accurate enough in my previous letter )<div><br></div><div>I do not wonder about drops, I know that drops could occur in buffers in network interface, in kernel buffers and also in buffers in VM. In my case there are not drops in kernel space accordingly to <font face="monospace">netstat -S</font>, <span style="font-family:monospace">ss -anump</span>, <font face="monospace">cat /proc/net/snmp | grep Udp, cat /proc/net/udp;</font> also it could be the bug in my code, which I can't find by some reason ))</div><div><br></div><div>Please, pay attention that after I'm trying to debug this behavior with strace/gdb the problem has gone. I'm interesting, how could I find/observer is there any drops in VM buffers or so... ?</div></div></blockquote><div><br></div><div>One thing you could try is to use systemtap instead of strace/gdb to monitor the UDP socket. It has much less impact on runtime behavior and might provide a clue as to whether the data is actually read from socket.</div><div><br></div><div>Also, have you tried using the new socket module instead of gen_udp?</div><div><br></div><div>Andreas</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">вт, 4 февр. 2020 г. в 16:07, Paul Peregud <<a href="mailto:paulperegud@gmail.com" target="_blank">paulperegud@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">AFAIK UDP packet can be dropped by anyone. By intermediate nodes and<br>
by your kernel. I would just assume that they can be dropped by your<br>
BEAM VM too. I also don't think that "it's always the second packet"<br>
behavior is strange. Play around with kernel buffers sizes and you<br>
will likely observe some change.<br>
<br>
Assumption that UDP packet that was sent will be delivered is wrong.<br>
<br>
On Tue, Feb 4, 2020 at 8:32 AM Alexander Petrovsky <<a href="mailto:askjuise@gmail.com" target="_blank">askjuise@gmail.com</a>> wrote:<br>
><br>
> Hello!<br>
><br>
> The first of all, my erlang version OTP-21.3 (without any minor patches)<br>
><br>
> 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):<br>
><br>
> send request: SIP options<br>
> receive a response: 100<br>
> receive a response: 200<br>
><br>
> In erlang it's implemented like gen_server which receives messages, the sockets options are: binary, {active, once}.<br>
><br>
> 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):<br>
> gen_udp:recv(Socket, 0, 0), bursts and after that set the socket option {active, once} back.<br>
><br>
> 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.<br>
><br>
> When I'm trying to add some logs into my erlang code, the problem disappears, when I'm run strace to recvfrom syscall the problem disappears... I't try to debug VM with gdb and make some breakpoints on sock_recvfrom in inet_drv.c (it's OTP-21.3), but the problem disappears (((<br>
><br>
> 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?<br>
><br>
> --<br>
> Петровский Александр / Alexander Petrovsky,<br>
><br>
> Skype: askjuise<br>
> Phone: +7 931 9877991<br>
><br>
<br>
<br>
-- <br>
Best regards,<br>
Paul Peregud<br>
+48602112091<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><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>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><p><span style="font-family:verdana,geneva,sans-serif;font-size:10pt">Andreas Schultz</span></p>
<p><span style="font-family:verdana,geneva,sans-serif;font-size:10pt">-- </span></p>
<p><span style="font-family:verdana,geneva,sans-serif;font-size:8pt">Principal Engineer</span></p>
<p><span style="font-family:verdana,geneva,sans-serif;font-size:10.6667px"> t: +49 391 819099-224 </span></p>
<p><span style="font-family:verdana,geneva,sans-serif;font-size:8pt"><span style="font-family:verdana,geneva,sans-serif;font-size:10.6667px"></span></span></p>
<p><span style="font-family:verdana,geneva,sans-serif;font-size:8pt">------------------------------- enabling your networks -----------------------------</span></p>
<table style="height:142px;width:550px">
<tbody>
<tr style="height:30px">
<td style="width:146px;height:30px">
<p><span style="font-family:verdana,geneva,sans-serif;color:rgb(34,34,34);font-size:8pt">Travelping GmbH <br></span><span style="font-family:verdana,geneva,sans-serif;color:rgb(34,34,34);font-size:8pt">Roentgenstraße 13<br></span><span style="font-family:verdana,geneva,sans-serif;color:rgb(34,34,34);font-size:8pt">39108 Magdeburg<br></span><span style="font-family:verdana,geneva,sans-serif;color:rgb(34,34,34);font-size:8pt">Germany<br><br></span></p>
</td>
<td style="width:162px;height:30px">
<p style="color:rgb(34,34,34);font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:small;text-align:justify"><span style="font-family:verdana,geneva,sans-serif;font-size:8pt">t: +49 391 819099-0<br></span><span style="font-family:verdana,geneva,sans-serif;font-size:8pt">f: +49 391 819099-299</span></p>
<p style="color:rgb(34,34,34);font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:small;text-align:justify"><span style="font-family:verdana,geneva,sans-serif;font-size:8pt">e: <a href="mailto:info@travelping.com" target="_blank">info@travelping.com</a><br></span><span style="font-family:verdana,geneva,sans-serif;font-size:8pt">w: <a href="https://www.travelping.com/" target="_blank">https://www.travelping.com/</a></span></p>
</td>
</tr>
<tr style="height:17px">
<td style="width:146px;height:17px"><span style="font-size:8pt;font-family:verdana,geneva,sans-serif">Company registration: Amtsgericht Stendal <br>Geschaeftsfuehrer: Holger Winkelmann<br></span></td>
<td style="width:162px;height:17px"><span style="font-size:8pt;font-family:verdana,geneva,sans-serif">Reg. No.: HRB 10578<br>VAT ID: DE236673780</span></td>
</tr>
</tbody>
</table></div></div>