Ubuntu下WebRTC应用UDP发送失败(错误11)问题求助
Let’s break down your issue step by step—those UDP send failed with error 11 and Resource temporarily unavailable logs point to UDP send buffer exhaustion, which is causing the stream to choke after 10-20 seconds. Here are actionable fixes and checks tailored to your setup:
1. Fix System-Level UDP Buffer Limits (Beyond Your Current sysctl Config)
You’ve adjusted some sysctl parameters, but missed critical UDP-specific settings that might be bottlenecking:
- Add/update these lines in
/etc/sysctl.conf:net.core.wmem_default = 8388608 net.core.wmem_min = 4096 net.ipv4.udp_mem = 8388608 16777216 33554432wmem_defaultsets the default send buffer size for all sockets (your app might be using this instead ofwmem_max)udp_memdefines system-wide UDP memory limits (min, pressure threshold, max)
- Apply changes with
sudo sysctl -pand restart your Electron app.
2. Disable WebRTC Hardware Encoding/Decoding
Your 2nd-gen Core i3 + Intel HD 3000 has limited hardware video support, and older Chromium (used by Electron) often has buggy hardware acceleration on this setup. This can cause encoding backlogs that flood the UDP buffer:
- Launch your Electron app with these flags:
This forces WebRTC to use software encoding, which might be more stable on your older hardware../your-electron-app --disable-webrtc-hw-encoding --disable-webrtc-hw-decoding
3. Reduce Stream Resolution & Bitrate
Your C930e can push high-resolution streams, but your old CPU can’t keep up, leading to data buildup:
- In your WebRTC code, cap the video stream to lower specs:
- Set resolution to 720p (1280x720) instead of 1080p
- Reduce frame rate to 15-20 FPS (from 30)
- Add a bitrate limit via
RTCRtpSender:const sender = pc.getSenders().find(s => s.track.kind === 'video'); const parameters = sender.getParameters(); parameters.encodings[0].maxBitrate = 1000000; // 1 Mbps sender.setParameters(parameters);
4. Adjust WiFi MTU to Avoid Fragmentation
Large UDP packets can get fragmented on WiFi, leading to send failures. Lower your WiFi adapter’s MTU to reduce fragmentation:
- Run this command temporarily to test:
sudo ip link set dev wlx0013ef503b67 mtu 1400 - If this helps, make it permanent by adding the MTU setting to your network config (e.g., in
/etc/network/interfacesor NetworkManager settings).
5. Upgrade Electron (If Compatible with Ubuntu 16.04)
Ubuntu 16.04 is end-of-life, but if you’re using an old Electron version, it might have outdated WebRTC stack bugs. Try upgrading to Electron 9.x or 10.x (the last versions that support Ubuntu 16.04’s libc version) to see if the UDP buffer handling is fixed.
6. Dig Deeper with Full strace Output
Your partial strace log doesn’t show the full picture. Run this to capture complete sendmsg failures:
strace -e sendmsg -p <your-electron-app-pid>
Look for EAGAIN or EWOULDBLOCK in the output—this confirms buffer exhaustion. If you see other errors, they might point to network routing or firewall issues.
内容的提问来源于stack exchange,提问作者AlgoDan

