Skip to content

Commit

Permalink
vendor: update drl with mutex fix
Browse files Browse the repository at this point in the history
cleanServerList was modifying the map without grabbing any lock at all.
Change how the lock is used in this code. Grab the lock only in exposed
methods, as the others are only called once from the exposed ones.

And use a single Mutex instead of a RWMutex, as both exposed methods do
writes. Previously, AddOrUpdateServer would first grab a write lock and
then grab some read locks. However, that's wasteful and can lead to
subtle inconsistencies and bugs. Grab the same lock throughout the func.

Fixes TykTechnologies#1216.
  • Loading branch information
mvdan committed Oct 20, 2017
1 parent 075e2e4 commit ec643a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
14 changes: 5 additions & 9 deletions vendor/github.com/TykTechnologies/drl/drl.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions vendor/vendor.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
"revisionTime": "2016-09-08T20:14:09Z"
},
{
"checksumSHA1": "dHkTVWqfuiW9oJTGa48eFJnYZQo=",
"checksumSHA1": "xK7PRpDoE+8idiyAlbqNqHiMu9E=",
"path": "github.com/TykTechnologies/drl",
"revision": "434bbccf78ee303df47c2b747e41fb7462b55d8a",
"revisionTime": "2016-11-02T10:42:53Z"
"revision": "5f99c27a1a55314fd0b33f47ad39028f55978763",
"revisionTime": "2017-10-18T14:32:39Z"
},
{
"checksumSHA1": "RE/gJeawCK3Zl9U2GkoQhpxcb5M=",
Expand Down

0 comments on commit ec643a9

Please sign in to comment.