Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data races #38

Closed
gg-gg-gg-gg opened this issue Jul 16, 2018 · 4 comments
Closed

Data races #38

gg-gg-gg-gg opened this issue Jul 16, 2018 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@gg-gg-gg-gg
Copy link
Contributor

gg-gg-gg-gg commented Jul 16, 2018

There's a few data races on the request object in proxy.go, going to tackle removing those and refactoring that file. Assign to me please @jacobheath

nati:~/golang/src/github.com/nccgroup/tracy/proxy$ go test -race -timeout 30s github.com/nccgroup/tracy/proxy -run ^TestFullProxy$
==================
WARNING: DATA RACE
Write at 0x00c4204f4790 by goroutine 83:
  github.com/nccgroup/tracy/proxy.handleConnection()
      /Users/nati/golang/src/github.com/nccgroup/tracy/proxy/proxy.go:157 +0x1447

Previous read at 0x00c4204f4790 by goroutine 20:
  github.com/nccgroup/tracy/proxy.handleConnection.func1()
      /Users/nati/golang/src/github.com/nccgroup/tracy/proxy/proxy.go:122 +0x53

Goroutine 83 (running) created at:
  github.com/nccgroup/tracy/proxy.(*Proxy).Accept()
      /Users/nati/golang/src/github.com/nccgroup/tracy/proxy/proxy.go:35 +0x128

Goroutine 20 (running) created at:
  github.com/nccgroup/tracy/proxy.handleConnection()
      /Users/nati/golang/src/github.com/nccgroup/tracy/proxy/proxy.go:121 +0x13ea
==================
--- FAIL: TestFullProxy (0.00s)
	testing.go:730: race detected during execution of test
FAIL
FAIL	github.com/nccgroup/tracy/proxy	0.087s
@jacobheath jacobheath added the enhancement New feature or request label Jul 16, 2018
@gg-gg-gg-gg
Copy link
Contributor Author

nati:~/golang/src/github.com/nccgroup/tracy$ git checkout nati/waitgroup-and-mutexes
Switched to branch 'nati/waitgroup-and-mutexes'
nati:~/golang/src/github.com/nccgroup/tracy$ /usr/local/go/bin/go test -race -benchmem -run=^$ github.com/nccgroup/tracy/proxy -bench ^BenchmarkFullProxy$
goos: darwin
goarch: amd64
pkg: github.com/nccgroup/tracy/proxy
BenchmarkFullProxy-4         500           6411523 ns/op          481362 B/op       5700 allocs/op
PASS
ok      github.com/nccgroup/tracy/proxy 4.880s

@gg-gg-gg-gg
Copy link
Contributor Author

🎉

@gg-gg-gg-gg
Copy link
Contributor Author

Little slower with the locking but once I do some memory optimizations it'll be good.

@heathj
Copy link
Collaborator

heathj commented Nov 2, 2018

This seems to be fixed now:

% go test -race -timeout 30s github.com/nccgroup/tracy/proxy -run ^TestFullProxy$
ok  	github.com/nccgroup/tracy/proxy	2.034s

@heathj heathj closed this as completed Nov 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants