thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jens Geyer (JIRA)" <j...@apache.org>
Subject [jira] [Reopened] (THRIFT-4237) Go TServerSocket Race Conditions
Date Wed, 05 Jul 2017 20:23:00 GMT

     [ https://issues.apache.org/jira/browse/THRIFT-4237?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jens Geyer reopened THRIFT-4237:
--------------------------------

It only hangs sometimes, but then with an interesting message:

{code}
Making check in test
make[3]: Entering directory `/thrift/src/lib/go/test'
mkdir -p gopath/src
grep -v list.*map.*list.*map ../../../test/ThriftTest.thrift | grep -v 'set<Insanity>'
> ThriftTest.thrift
../../../compiler/cpp/thrift -out gopath/src/ --gen go:thrift_import=thrift -r IncludesTest.thrift
[WARNING:/thrift/src/lib/go/test/ThriftTest.thrift:45] No generator named 'noexist' could
be found!
[WARNING:/thrift/src/lib/go/test/ThriftTest.thrift:47] cpp generator does not accept 'noexist'
as sub-namespace!
[WARNING:/thrift/src/lib/go/test/ThriftTest.thrift:45] No generator named 'noexist' could
be found!
[WARNING:/thrift/src/lib/go/test/ThriftTest.thrift:47] cpp generator does not accept 'noexist'
as sub-namespace!
../../../compiler/cpp/thrift -out gopath/src/ --gen go:thrift_import=thrift BinaryKeyTest.thrift
../../../compiler/cpp/thrift -out gopath/src/ --gen go:thrift_import=thrift MultiplexedProtocolTest.thrift
../../../compiler/cpp/thrift -out gopath/src/ --gen go:thrift_import=thrift OnewayTest.thrift
../../../compiler/cpp/thrift -out gopath/src/ --gen go:thrift_import=thrift OptionalFieldsTest.thrift
../../../compiler/cpp/thrift -out gopath/src/ --gen go:thrift_import=thrift ServicesTest.thrift
../../../compiler/cpp/thrift -out gopath/src/ --gen go:thrift_import=thrift GoTagTest.thrift
../../../compiler/cpp/thrift -out gopath/src/ --gen go:thrift_import=thrift TypedefFieldTest.thrift
../../../compiler/cpp/thrift -out gopath/src/ --gen go:thrift_import=thrift RefAnnotationFieldsTest.thrift
../../../compiler/cpp/thrift -out gopath/src/ --gen go:thrift_import=thrift UnionDefaultValueTest.thrift
../../../compiler/cpp/thrift -out gopath/src/ --gen go:thrift_import=thrift ErrorTest.thrift
../../../compiler/cpp/thrift -out gopath/src/ --gen go:thrift_import=thrift NamesTest.thrift
../../../compiler/cpp/thrift -out gopath/src/ --gen go:thrift_import=thrift InitialismsTest.thrift
../../../compiler/cpp/thrift -out gopath/src/ --gen go:thrift_import=thrift,read_write_private
DontExportRWTest.thrift
../../../compiler/cpp/thrift -out gopath/src/ --gen go:thrift_import=thrift,ignore_initialisms
IgnoreInitialismsTest.thrift
GOPATH=`pwd`/gopath /usr/local/go/bin/go get github.com/golang/mock/gomock
ln -nfs ../../../thrift gopath/src/thrift
ln -nfs ../../tests gopath/src/tests
cp -r ./dontexportrwtest gopath/src
touch gopath
GOPATH=`pwd`/gopath /usr/local/go/bin/go build \
				includestest \
				binarykeytest \
				servicestest \
				typedeffieldtest \
				refannotationfieldstest \
				errortest	\
				namestest \
				initialismstest \
				dontexportrwtest \
				ignoreinitialismstest
GOPATH=`pwd`/gopath /usr/local/go/bin/go test thrift tests dontexportrwtest
ok  	thrift	0.027s


No output has been received in the last 10m0s, this potentially indicates a stalled build
or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received

The build has been terminated
{code}


> Go TServerSocket Race Conditions
> --------------------------------
>
>                 Key: THRIFT-4237
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4237
>             Project: Thrift
>          Issue Type: Bug
>          Components: Go - Library
>    Affects Versions: 0.10.0
>            Reporter: Zach Wasserman
>            Assignee: Zach Wasserman
>              Labels: concurrency
>             Fix For: 0.11.0
>
>
> Run the following test with {{go test -race -run TestSocketConcurrency}}:
> {code}
> func TestSocketConcurrency(t *testing.T) {
> 	host := "127.0.0.1"
> 	port := 9090
> 	addr := fmt.Sprintf("%s:%d", host, port)
> 	socket := CreateServerSocket(t, addr)
> 	go func() { socket.Listen() }()
> 	go func() { socket.Interrupt() }()
> }
> {code}
> This will result in an error from the race detector. It looks like:
> {code}
> go test -v -race -run TestSocketConcurrency
> === RUN   TestSocketConcurrency
> --- PASS: TestSocketConcurrency (0.00s)
> ==================
> WARNING: DATA RACE
> Write at 0x00c420016870 by goroutine 7:
>   git.apache.org/thrift.git/lib/go/thrift.(*TServerSocket).Listen()
>       /Users/zwass/dev/go/src/git.apache.org/thrift.git/lib/go/thrift/server_socket.go:63
+0x134
>   git.apache.org/thrift.git/lib/go/thrift.TestSocketConcurrency.func1()
>       /Users/zwass/dev/go/src/git.apache.org/thrift.git/lib/go/thrift/server_socket_test.go:50
+0x38
> Previous read at 0x00c420016870 by goroutine 8:
>   git.apache.org/thrift.git/lib/go/thrift.(*TServerSocket).Close()
>       /Users/zwass/dev/go/src/git.apache.org/thrift.git/lib/go/thrift/server_socket.go:114
+0x7b
>   git.apache.org/thrift.git/lib/go/thrift.(*TServerSocket).Interrupt()
>       /Users/zwass/dev/go/src/git.apache.org/thrift.git/lib/go/thrift/server_socket.go:123
+0x6b
>   git.apache.org/thrift.git/lib/go/thrift.TestSocketConcurrency.func2()
>       /Users/zwass/dev/go/src/git.apache.org/thrift.git/lib/go/thrift/server_socket_test.go:51
+0x38
> Goroutine 7 (running) created at:
>   git.apache.org/thrift.git/lib/go/thrift.TestSocketConcurrency()
>       /Users/zwass/dev/go/src/git.apache.org/thrift.git/lib/go/thrift/server_socket_test.go:50
+0x1a8
>   testing.tRunner()
>       /usr/local/Cellar/go/1.8/libexec/src/testing/testing.go:657 +0x107
> Goroutine 8 (running) created at:
>   git.apache.org/thrift.git/lib/go/thrift.TestSocketConcurrency()
>       /Users/zwass/dev/go/src/git.apache.org/thrift.git/lib/go/thrift/server_socket_test.go:51
+0x1ca
>   testing.tRunner()
>       /usr/local/Cellar/go/1.8/libexec/src/testing/testing.go:657 +0x107
> ==================
> ==================
> WARNING: DATA RACE
> Write at 0x00c420016870 by goroutine 8:
>   git.apache.org/thrift.git/lib/go/thrift.(*TServerSocket).Close.func1()
>       /Users/zwass/dev/go/src/git.apache.org/thrift.git/lib/go/thrift/server_socket.go:112
+0x3b
>   git.apache.org/thrift.git/lib/go/thrift.(*TServerSocket).Close()
>       /Users/zwass/dev/go/src/git.apache.org/thrift.git/lib/go/thrift/server_socket.go:117
+0xe6
>   git.apache.org/thrift.git/lib/go/thrift.(*TServerSocket).Interrupt()
>       /Users/zwass/dev/go/src/git.apache.org/thrift.git/lib/go/thrift/server_socket.go:123
+0x6b
>   git.apache.org/thrift.git/lib/go/thrift.TestSocketConcurrency.func2()
>       /Users/zwass/dev/go/src/git.apache.org/thrift.git/lib/go/thrift/server_socket_test.go:51
+0x38
> Previous read at 0x00c420016870 by goroutine 7:
>   git.apache.org/thrift.git/lib/go/thrift.(*TServerSocket).Listen()
>       /Users/zwass/dev/go/src/git.apache.org/thrift.git/lib/go/thrift/server_socket.go:56
+0x48
>   git.apache.org/thrift.git/lib/go/thrift.TestSocketConcurrency.func1()
>       /Users/zwass/dev/go/src/git.apache.org/thrift.git/lib/go/thrift/server_socket_test.go:50
+0x38
> Goroutine 8 (running) created at:
>   git.apache.org/thrift.git/lib/go/thrift.TestSocketConcurrency()
>       /Users/zwass/dev/go/src/git.apache.org/thrift.git/lib/go/thrift/server_socket_test.go:51
+0x1ca
>   testing.tRunner()
>       /usr/local/Cellar/go/1.8/libexec/src/testing/testing.go:657 +0x107
> Goroutine 7 (finished) created at:
>   git.apache.org/thrift.git/lib/go/thrift.TestSocketConcurrency()
>       /Users/zwass/dev/go/src/git.apache.org/thrift.git/lib/go/thrift/server_socket_test.go:50
+0x1a8
>   testing.tRunner()
>       /usr/local/Cellar/go/1.8/libexec/src/testing/testing.go:657 +0x107
> ==================
> FAIL
> exit status 1
> FAIL	git.apache.org/thrift.git/lib/go/thrift	0.186s
> {code}
> I believe this is because {{Interrupt()}}
>  (https://github.com/apache/thrift/blob/master/lib/go/thrift/server_socket.go#L120) and
{{Listen()}} (https://github.com/apache/thrift/blob/master/lib/go/thrift/server_socket.go#L55)
both read and write {{p.listener}}, but only {{Interrupt()}} locks the mutex.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message