The iPad was on Tailscale: a WebRTC debugging story
6 hours ago
- #Tailscale
- #WebRTC
- #Debugging
- A p2claw app loaded on an iPad but showed a blank page while working on other devices, leading to a complex debugging process.
- The problem was traced to WebRTC data channel communication failing, where data sent from the box agent was not being received by the iPad, causing the page to hang.
- Initial suspects included the iPad, WebKit, and Tailscale, but the root cause was two combined issues: a hardcoded MTU constant in webrtc-rs and Tailscale dropping IPv6 fragments.
- WeBRTC data channels guarantee in-order delivery; missing chunks block subsequent messages, which occurred due to packet loss.
- Tailscale, a VPN, wraps traffic in an extra layer, reducing packet size and causing large packets to fragment. Tailscale's IPv6 parser drops IPv6 fragments by design, leading to packet loss.
- Debugging revealed that IPv6 fragments were being dropped by Tailscale's ACL policy, while IPv4 fragments were handled correctly, explaining the intermittent issue.
- The solution involved capping message sizes to avoid fragmentation and filing issues with webrtc-rs and Tailscale for fixes.
- Key lessons: sender-side packet captures only show packets leaving, not arrival; and bugs specific to one device may involve unique network paths.
- This case highlights challenges in peer-to-peer applications and the importance of considering path MTU and fragmentation in network programming.