Skip to content

Commit badb8b5

Browse files
authored
Merge pull request #629 from fredericdalleau/drop-deadlock-detector
Revert "go: use deadlock.Mutex to check for deadlocks"
2 parents 6f5de38 + bf7fb8d commit badb8b5

34 files changed

+13
-1590
lines changed

go.mod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ require (
5252
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 // indirect
5353
github.com/pelletier/go-toml v1.4.0 // indirect
5454
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
55-
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
5655
github.com/pmezard/go-difflib v1.0.0 // indirect
57-
github.com/sasha-s/go-deadlock v0.3.1 // indirect
5856
github.com/spf13/afero v1.2.2 // indirect
5957
github.com/spf13/cast v1.3.0 // indirect
6058
github.com/spf13/jwalterweatherman v1.1.0 // indirect

go.sum

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ github.com/pelletier/go-toml v1.4.0 h1:u3Z1r+oOXJIkxqw34zVhyPgjBsm6X2wn21NWs/HfS
122122
github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo=
123123
github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI=
124124
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
125-
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ=
126-
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o=
127125
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
128126
github.com/pkg/errors v0.8.1-0.20181023235946-059132a15dd0 h1:TVdhkEP0WKajbywS5TEDWwuzCl9EqOcQ6b1ymfmx/6E=
129127
github.com/pkg/errors v0.8.1-0.20181023235946-059132a15dd0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
@@ -139,8 +137,6 @@ github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R
139137
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
140138
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
141139
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
142-
github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0=
143-
github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM=
144140
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
145141
github.com/sirupsen/logrus v1.3.0 h1:hI/7Q+DtNZ2kINb6qt/lS+IyXnHQe9e90POfeewL/ME=
146142
github.com/sirupsen/logrus v1.3.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=

go/pkg/libproxy/loopbackconn.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import (
55
"net"
66
"sync"
77
"time"
8-
9-
"github.com/sasha-s/go-deadlock"
108
)
119

1210
// io.Pipe is synchronous but we need to decouple the Read and Write calls
@@ -21,7 +19,7 @@ import (
2119
type bufferedPipe struct {
2220
bufs [][]byte
2321
eof bool
24-
m deadlock.Mutex
22+
m sync.Mutex
2523
c *sync.Cond
2624
readDeadline time.Time
2725
}

go/pkg/libproxy/multiplexed.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"sync"
1212
"time"
1313

14-
"github.com/sasha-s/go-deadlock"
1514
"golang.org/x/sync/errgroup"
1615
)
1716

@@ -40,7 +39,7 @@ func (w *windowState) advance() {
4039
}
4140

4241
type channel struct {
43-
m deadlock.Mutex
42+
m sync.Mutex
4443
c *sync.Cond
4544
multiplexer *multiplexer
4645
destination Destination
@@ -347,15 +346,15 @@ type multiplexer struct {
347346
conn io.Closer
348347
connR io.Reader // with buffering
349348
connW *bufio.Writer
350-
writeMutex deadlock.Mutex // hold when writing on the channel
349+
writeMutex sync.Mutex // hold when writing on the channel
351350
channels map[uint32]*channel
352351
nextChannelID uint32
353-
metadataMutex deadlock.Mutex // hold when reading/modifying this structure
354-
pendingAccept []*channel // incoming connections
352+
metadataMutex sync.Mutex // hold when reading/modifying this structure
353+
pendingAccept []*channel // incoming connections
355354
acceptCond *sync.Cond
356355
isRunning bool
357356
events *ring.Ring // log of packetEvents
358-
eventsM deadlock.Mutex
357+
eventsM sync.Mutex
359358
allocateBackwards bool
360359
}
361360

go/pkg/libproxy/multiplexed_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"testing"
1313
"time"
1414

15-
"github.com/sasha-s/go-deadlock"
1615
"github.com/stretchr/testify/assert"
1716
"github.com/stretchr/testify/require"
1817
"golang.org/x/sync/errgroup"
@@ -493,7 +492,7 @@ func TestMuxConcurrent(t *testing.T) {
493492
serverReadSha := make(map[uint16]string)
494493
clientWriteSha := make(map[uint16]string)
495494
clientReadSha := make(map[uint16]string)
496-
m := &deadlock.Mutex{}
495+
m := &sync.Mutex{}
497496
wg.Add(numConcurrent)
498497
for i := 0; i < numConcurrent; i++ {
499498
go func(i int) {

go/pkg/libproxy/udp_encapsulation.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ import (
66
"errors"
77
"io"
88
"net"
9+
"sync"
910
"time"
10-
11-
"github.com/sasha-s/go-deadlock"
1211
)
1312

1413
// UDPListener defines a listener interface to read, write and close a UDP connection
@@ -29,9 +28,9 @@ type uDPEncapsulator interface {
2928
// udpEncapsulator encapsulates a UDP connection and listener
3029
type udpEncapsulator struct {
3130
conn net.Conn
32-
m deadlock.Mutex
33-
r deadlock.Mutex
34-
w deadlock.Mutex
31+
m sync.Mutex
32+
r sync.Mutex
33+
w sync.Mutex
3534
addr *net.UDPAddr
3635
}
3736

go/pkg/libproxy/udp_proxy.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ import (
44
"encoding/binary"
55
"net"
66
"strings"
7+
"sync"
78
"syscall"
89
"time"
9-
10-
"github.com/sasha-s/go-deadlock"
1110
)
1211

1312
const (
@@ -51,7 +50,7 @@ type UDPProxy struct {
5150
backendAddr *net.UDPAddr
5251
dialer UDPDialer
5352
connTrackTable connTrackMap
54-
connTrackLock deadlock.Mutex
53+
connTrackLock sync.Mutex
5554
}
5655

5756
// UDPDialer creates UDP (pseudo-)connections to an address

vendor/github.com/petermattis/goid/.gitignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

vendor/github.com/petermattis/goid/.travis.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

vendor/github.com/petermattis/goid/LICENSE

Lines changed: 0 additions & 202 deletions
This file was deleted.

0 commit comments

Comments
 (0)