[tor-bugs] #21312 [Obfuscation/Snowflake]: snowflake-client is pegged at 100% cpu

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Mar 15 05:54:36 UTC 2018


#21312: snowflake-client is pegged at 100% cpu
-----------------------------------+------------------------------
 Reporter:  arlolra                |          Owner:  arlolra
     Type:  defect                 |         Status:  needs_review
 Priority:  High                   |      Milestone:
Component:  Obfuscation/Snowflake  |        Version:
 Severity:  Major                  |     Resolution:
 Keywords:                         |  Actual Points:
Parent ID:                         |         Points:
 Reviewer:                         |        Sponsor:
-----------------------------------+------------------------------

Comment (by arlolra):

 > I put some guards around that and now my proxy seems to be happily
 serving connections w/o crash.

 I mean, in go-webrtc,

 {{{
 --- a/peerconnection.go
 +++ b/peerconnection.go
 @@ -44,6 +44,7 @@ import "C"
  import (
         "errors"
         "fmt"
 +       "sync"
         "unsafe"
  )

 @@ -124,6 +125,8 @@ type PeerConnection struct {
         localDescription        *SessionDescription
         remoteDescription       *SessionDescription
         canTrickleIceCandidates bool
 +       destroyed               bool
 +       destroyLock             *sync.Mutex

         // Event handlers
         OnNegotiationNeeded        func()
 @@ -152,6 +155,7 @@ func NewPeerConnection(config *Configuration)
 (*PeerConnection, error) {
                 return nil, errors.New("PeerConnection requires a
 Configuration.")
         }
         pc := new(PeerConnection)
 +       pc.destroyLock = &sync.Mutex{}
         pc.index = PCMap.Set(pc)
         // Internal CGO Peer wraps the native
 webrtc::PeerConnectionInterface.
         pc.cgoPeer = C.CGO_InitializePeer(C.int(pc.index))
 @@ -169,6 +173,12 @@ func NewPeerConnection(config *Configuration)
 (*PeerConnection, error) {
  }

  func (pc *PeerConnection) Destroy() error {
 +       pc.destroyLock.Lock()
 +       if pc.destroyed {
 +               return nil
 +       }
 +       pc.destroyed = true
 +       pc.destroyLock.Unlock()
         err := pc.Close()
         PCMap.Delete(pc.index)
         C.CGO_DestroyPeer(pc.cgoPeer)
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/21312#comment:49>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list