[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #25688 [Obfuscation/Snowflake]: proxy-go is still deadlocking occasionally



#25688: proxy-go is still deadlocking occasionally
--------------------------------------------+--------------------------
 Reporter:  dcf                             |          Owner:  cohosh
     Type:  defect                          |         Status:  assigned
 Priority:  Low                             |      Milestone:
Component:  Obfuscation/Snowflake           |        Version:
 Severity:  Normal                          |     Resolution:
 Keywords:  network-team-roadmap-2019-Q1Q2  |  Actual Points:
Parent ID:                                  |         Points:  3
 Reviewer:                                  |        Sponsor:
--------------------------------------------+--------------------------

Comment (by cohosh):

 This is likely the cause of the problem. OnICEComplete is fired when the
 ICEGatheringState is  complete:
 {{{
 func cgoOnIceGatheringStateChange(p int, state IceGatheringState) {
         INFO.Println("fired OnIceGatheringStateChange:", p)
 ...
         if IceGatheringStateComplete == state && nil != pc.OnIceComplete {
                 pc.OnIceComplete()
 }}}

 However, we see an ICE Candidate error in the logs right before the
 deadlock:
 {{{
 INFO: peerconnection.go:513: fired OnIceGatheringStateChange: 1046
 INFO: peerconnection.go:468: fired OnIceCandidateError:  1046
 }}}

 This error appears to occur *after* OnIceComplete() is fired, meaning that
 in the proxy-go code:
 {{{
         pc.OnIceComplete = func() {
                 answerChan <- struct{}{}
         }
 }}}
 occurs, which results in the answer channel being read instead of the
 error channel:
 {{{
         // Wait until answer is ready.
         select {
         case err = <-errChan:
                 pc.Destroy()
                 return nil, err
         case _, ok := <-answerChan:
                 if !ok {
                         pc.Destroy()
                         return nil, fmt.Errorf("Failed gathering ICE
 candidates.")
                 }
         }
         return pc, nil
 }}}
 This causes the function {{{makePeerConnection}}} to return a nil error,
 bypassing the retToken() call:
 {{{
         pc, err := makePeerConnectionFromOffer(offer, config)
         if err != nil {
                 log.Printf("error making WebRTC connection: %s", err)
                 retToken()
                 return
         }
 }}}
 Because of the ICEcandidate error, OnDataChannel is never called.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/25688#comment:11>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs