cloudfoundry/gorouter — pull request #28 by jackfengibm (2014-02-21 19:43:36+00:00)
Title: fixed races conditions found in server_test.go

This pull request aims at fixing a race race condition error as reported by the GO race detector:

==================
{"timestamp":1390798621.757039070,"process_id":9430,"source":"router.global","log_level":"info","message":"State is stale; NOT pruning","data":null}
Found 12 data race(s)
FAIL github.com/cloudfoundry/gorouter/router 14.450s
==================
WARNING: DATA RACE
Write by goroutine 104:
github.com/cloudfoundry/gorouter/server_test.countReader.Read()
/Users/jackfeng/go/src/github.com/cloudfoundry/gorouter/server/server_test.go:982 +0xa0
github.com/cloudfoundry/gorouter/server_test.(*countReader).Read()
/Users/jackfeng/go/src/github.com/cloudfoundry/gorouter/server/server_test.go:0 +0xec
io.(*LimitedReader).Read()
/usr/local/go/src/pkg/io/io.go:394 +0x13f
io/ioutil.(*nopCloser).Read()
/usr/local/go/src/pkg/io/ioutil/blackhole.go:1 +0x7d
io.(*multiReader).Read()
/usr/local/go/src/pkg/io/multi.go:13 +0xe0
io.Copy()
/usr/local/go/src/pkg/io/io.go:348 +0x1d8
net/http.(*transferWriter).WriteBody()
/usr/local/go/src/pkg/net/http/transfer.go:189 +0x225
net/http.(*Request).write()
/usr/local/go/src/pkg/net/http/request.go:387 +0xa10
net/http.(*persistConn).writeLoop()
/usr/local/go/src/pkg/net/http/transport.go:780 +0x20e
gosched0()
/usr/local/go/src/pkg/runtime/proc.c:1218 +0x9f

Previous read by goroutine 48:
github.com/cloudfoundry/gorouter/server_test.TestRequestBodyLimit()
/Users/jackfeng/go/src/github.com/cloudfoundry/gorouter/server/server_test.go:1014 +0x306
testing.tRunner()
/usr/local/go/src/pkg/testing/testing.go:353 +0x12f
gosched0()
/usr/local/go/src/pkg/runtime/proc.c:1218 +0x9f