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

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



#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
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs