Closed Bug 915752 Opened 13 years ago Closed 13 years ago

DTLS connection establishment randomly failing under low packet loss

Categories

(Core :: WebRTC: Networking, defect)

22 Branch
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: gustavogb, Assigned: ekr)

Details

(Whiteboard: [webrtc])

Attachments

(3 files)

Attached file firefox_dtls_fail.pcap —
When trying to connect from Firefox to our server under low packet loss usually some of the 4 DTLS connections fails and you get a black screen. This doesn't happen from Chrome to our server in the same scenario (even if it creates also 4 DTLS in our case). I've seen it happening also in P2P Firefox to Chrome connections under low packet loss. Find attached a network capture where 1 of the 4 connection failed and the DTLS establishment was not completed. It is easy to reproduce by me by introducing a 5% of packet loss with ipfw in Mac.
May be related to bug 890931
Assignee: nobody → ekr
Status: UNCONFIRMED → NEW
Ever confirmed: true
Whiteboard: [webrtc]
Gustavo, I have some questions about this trace: 1. I assume that Firefox is the DTLS server in this case and you are the DTLS client? 2. Where was this packet trace taken from? Based on the retransmit pattern I am guessing the server? Which packets do you think were dropped? 3. Can you provide Firefox mtransport logging (NSPR_LOG_MODULES=mtransport:5)
Hmmm.... I just wrote a unit test in which we randomly drop packets in each direction at a 5% rate and it seems to work fine over 100 runs with a variety of loss patterns. If you can provide the info above, I will see if I can figure out why this isn't showing your problem.
Flags: needinfo?(gustavogb)
Thank you very much for your time. 1. Yes, FF is the DTLS server and we are the DTLS client 2. It was taken on the client. My assumption is that the Change Cipher Spec message (frame No. 502) is lost. 3. I will do it ASAP
Flags: needinfo?(gustavogb)
Gustav, I did try emulating the failure you propose in #2 in our test harness and Firefox seems to behave correctly. More questions: 1. Are these organic failures observed in the wild or something you are generating with ipfw? 2. If it's ipfw, can you add the packet filter here so I can try to reproduce.
Generated with ipfw: ipfw pipe 1 config plr 0.05 ipfw add pipe 1 ip from any to any I was able to reproduce it again today. Find attached the wireshark capture + firefox logs. In both files (and in our server logs too) I see only 3 DTLS establishments instead of 4. 50.112.218.130 is our server that in this case is the DTLS Client 192.168.1.68 is my Firefox (Nightly 23) that in this case is the DTLS Server Let me know if I there is anything else you need or if you think that it is an issue derived from using ipfw and not a real network congestion.
0. Can you reproduce this at all in the wild without using PCAP? 1. Where is the IPFW configuration? Client or server? 2. If I am reading this ipfw config correctly, you are dropping packets on transmission rather than receipt? If so (and depending on the answer to #1) can I also get a PCAP from the other side. What I'm trying to get here is that things look like from the perspective of Firefox.
Flags: needinfo?(gustavogb)
Revised questions: 1. s/PCAP/IPFW/ 2. You can ignore question 2.
0. We have random failures in the wild from time to time (not often), but I cannot ensure if they are related to packet loss and DTLS or not. 1. IPFW is in the Firefox side (192.168.1.68). The server is in production and I cannot generate packet loss there :-)
Flags: needinfo?(gustavogb)
OK, based on these logs, I think the problem is that IPFW is inducing errors that are causing the DTLS handshake to fail. Look at the following two lines: 100167680[105b062b0]: Couldn't send media on 'stream2' 100167680[105b062b0]: Flow[906efc32225c67e0:2,rtcp(none)]; Layer[dtls]: SSL handshake error -5991 If you look through the code, we see that the error on the first line appears at: http://dxr.mozilla.org/mozilla-central/source/media/mtransport/nricemediastream.cpp#l397 Which basically corresponds to failure to write to the socket. And we deal with this by basically abandoning the connection. I don't know much about ipfw dummynet, but I have seen cases where firewall blocking with ipfw causes network writes to return errors to the caller. If that's what's happening here then it's probably an artifact of the simulation technique you are using with ipfw. Are you able to stand up a separate box with ipfw that drops packets but doesn't generate ICMP or otherwise feedback to the client?
I believe we have concluded this is an error in the test setup. Closing as WFM. Feel free to re-open if you can repro in a case where you have the packet filtering on a separate machine.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: