How to solve: UDP send of xxx bytes failed with error 11 in Ubuntu?

1

UDP send of XXXX bytes failed with error 11

I am running a WebRTC streaming app on Ubuntu 16.04. It streams video and audio from Logitec HD Webcam c930e within an Electronjs Desktop App.

It all works fine and smooth running on my other machine Macbook Pro. But on my Ubuntu machine I receive errors after 10-20 seconds when the peer connection is established:

[2743:0513/193817.691636:ERROR:stunport.cc(282)] Jingle:Port[0xa5faa3df800:audio:1:0:local:Net[wlx0013ef503b67:192.168.0.x/24:Wifi]]: UDP send of 1019 bytes failed with error 11
[2743:0513/193817.691775:ERROR:stunport.cc(282)] Jingle:Port[0xa5faa3df800:audio:1:0:local:Net[wlx0013ef503b67:192.168.0.x/24:Wifi]]: UDP send of 1020 bytes failed with error 11
[2743:0513/193817.696615:ERROR:stunport.cc(282)] Jingle:Port[0xa5faa3df800:audio:1:0:local:Net[wlx0013ef503b67:192.168.0.x/24:Wifi]]: UDP send of 1020 bytes failed with error 11
[2743:0513/193817.696777:ERROR:stunport.cc(282)] Jingle:Port[0xa5faa3df800:audio:1:0:local:Net[wlx0013ef503b67:192.168.0.x/24:Wifi]]: UDP send of 1020 bytes failed with error 11
[2743:0513/193817.712369:ERROR:stunport.cc(282)] Jingle:Port[0xa5faa3df800:audio:1:0:local:Net[wlx0013ef503b67:192.168.0.x/24:Wifi]]: UDP send of 1029 bytes failed with error 11
[2743:0513/193817.712952:ERROR:stunport.cc(282)] Jingle:Port[0xa5faa3df800:audio:1:0:local:Net[wlx0013ef503b67:192.168.0.x/24:Wifi]]: UDP send of 1030 bytes failed with error 11
[2743:0513/193817.713086:ERROR:stunport.cc(282)] Jingle:Port[0xa5faa3df800:audio:1:0:local:Net[wlx0013ef503b67:192.168.0.x/24:Wifi]]: UDP send of 1030 bytes failed with error 11
[2743:0513/193817.717713:ERROR:stunport.cc(282)] Jingle:Port[0xa5faa3df800:audio:1:0:local:Net[wlx0013ef503b67:192.168.0.x/24:Wifi]]: UDP send of 1030 bytes failed with error 11 

==> Btw, if I do NOT stream audio, but video only. I got the same error but only with the "video" between the Log lines...

somewhere in between the lines I also got one line that says:

[3441:0513/195919.377887:ERROR:stunport.cc(506)] sendto: [0x0000000b] Resource temporarily unavailable

I also looked into sysctl.conf and increased the values there. My currenct sysctl.conf looks like this:

fs.file-max=1048576
fs.inotify.max_user_instances=1048576
fs.inotify.max_user_watches=1048576
fs.nr_open=1048576
net.core.netdev_max_backlog=1048576
net.core.rmem_max=16777216
net.core.somaxconn=65535
net.core.wmem_max=16777216
net.ipv4.tcp_congestion_control=htcp
net.ipv4.ip_local_port_range=1024 65535
net.ipv4.tcp_fin_timeout=5
net.ipv4.tcp_max_orphans=1048576
net.ipv4.tcp_max_syn_backlog=20480
net.ipv4.tcp_max_tw_buckets=400000
net.ipv4.tcp_no_metrics_save=1
net.ipv4.tcp_rmem=4096 87380 16777216
net.ipv4.tcp_synack_retries=2
net.ipv4.tcp_syn_retries=2
net.ipv4.tcp_tw_recycle=1
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_wmem=4096 65535 16777216
vm.max_map_count=1048576
vm.min_free_kbytes=65535
vm.overcommit_memory=1
vm.swappiness=0
vm.vfs_cache_pressure=50

Like suggested here: https://gist.github.com/cdgraff/7920db287988463aafd7ea09eef6f9f0

It does not seem to help. I am still getting these errors and I experience lagging on the other side.

Additional info: on Ubuntu the Electronjs App connects to Heroku Server (Nodejs) and the other side of the peer connection (Chrome Browser) also connects to it. Heroku Server acts as Handshaking Server to establish WebRTC connection. Both have as configuration:

{'urls': 'stun:stun1.l.google.com:19302'},

{'urls': 'stun:stun2.l.google.com:19302'},

and also an additional Turn Server from numb.viagenie.ca

Connection is established and within the first 10 seconds the quality is very high and there is no lagging at all. But then after 10-20 seconds there is lagging and on the Ubuntu console I am getting these UDP errors.

The PC that Ubuntu is running on:

PROCESSOR / CHIPSET:

CPU Intel Core i3 (2nd Gen) 2310M / 2.1 GHz

Number of Cores: Dual-Core

Cache: 3 MB

64-bit Computing: Yes

Chipset Type: Mobile Intel HM65 Express

RAM:

Memory Speed: 1333 MHz

Memory Specification Compliance: PC3-10600

Technology: DDR3 SDRAM

Installed Size: 4 GB

Rated Memory Speed: 1333 MHz

Graphics

Graphics Processor Intel HD Graphics 3000

Could please anyone give me some hints or anything that could solve this problem?

Thank you

==============EDIT=============

I found in my very large strace log somewhere these two lines:

7671  sendmsg(17, {msg_name(0)=NULL, msg_iov(1)=[{"CHILD_PING\0", 11}], msg_controllen=0, msg_flags=0}, MSG_NOSIGNAL) = 11

7661  <... recvmsg resumed> {msg_name(0)=NULL, msg_iov(1)=[{"CHILD_PING\0", 12}], msg_controllen=32, [{cmsg_len=28, cmsg_level=SOL_SOCKET, cmsg_type=SCM_CREDENTIALS, {pid=7671, uid=0, gid=0}}], msg_flags=0}, 0) = 11

On top of that, somewhere near when the error happens (at the end of the log file, just before I quit the application) I see in the log file the following:

https://gist.github.com/Mcdane/2342d26923e554483237faf02cc7cfad

udp
webrtc
ubuntu-16.04
stun
turn
asked on Stack Overflow May 13, 2018 by Nerd • edited May 13, 2018 by Nerd

1 Answer

0

First, to get an impression of what is happening in the first place, I'd look with strace. Start your application with

strace -e network -o log.strace -f YOUR_APPLICATION

If your application looks for another running process to turn the work too, start it with parameters so it doesn't do that. For instance, for Chrome, pass in a --user-data-dir value that is different from your default.

Look for = 11 in the output file log.strace afterwards, and look what happened before and after. This will give you a rough picture of what is happening, and you can exclude silly mistakes like sendtos to 0.0.0.0 or so (For this reason, this is also very important information to include in a stackoverflow question, for instance by uploading the output to gist).

It may also be helpful to use Wireshark or another packet capture program to get a rough overview of what is being sent.

Assuming you can confirm with strace that a valid send call is taken place, you can then further analyze the error conditions.

Error 11 is EAGAIN. The documentation of send says when this error is supposed to happen:

EAGAIN (...) The socket is marked nonblocking and the requested operation would block. (...)

EAGAIN (Internet domain datagram sockets) The socket referred to by sockfd had not previously been bound to an address and, upon attempting to bind it to an ephemeral port, it was determined that all port numbers in the ephemeral port range are currently in use. See the discussion of /proc/sys/net/ipv4/ip_local_port_range in ip(7).

Both conditions could apply. The first will be obvious by the strace log if you trace the creation of the socket involved.

To exclude the second, you can run netstat -una (or, if you want to know the programs involved, sudo netstat -unap) to see which ports are open (if you want Stack Overflow users to look into it, post the output on gist or similar and link to it here). Your port range net.ipv4.ip_local_port_range=1024 65535 is not the standard 32768 60999; this looks like you attempted to do something about lacking port numbers already. It would help to trace back to the reason of why you changed that parameter, and the conditions that convinced you to do so.

answered on Stack Overflow May 13, 2018 by phihag • edited May 13, 2018 by phihag

User contributions licensed under CC BY-SA 3.0