Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B100F200CC2 for ; Wed, 5 Jul 2017 23:01:05 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id AEAEB1647A2; Wed, 5 Jul 2017 21:01:05 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C06A716479E for ; Wed, 5 Jul 2017 23:01:04 +0200 (CEST) Received: (qmail 85065 invoked by uid 500); 5 Jul 2017 21:01:03 -0000 Mailing-List: contact dev-help@thrift.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@thrift.apache.org Delivered-To: mailing list dev@thrift.apache.org Received: (qmail 85054 invoked by uid 99); 5 Jul 2017 21:01:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jul 2017 21:01:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 75EEDC0158 for ; Wed, 5 Jul 2017 21:01:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.001 X-Spam-Level: X-Spam-Status: No, score=-100.001 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id ynVI0Hm4qTUl for ; Wed, 5 Jul 2017 21:01:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 4338B5FB7F for ; Wed, 5 Jul 2017 21:01:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 83BBAE0D48 for ; Wed, 5 Jul 2017 21:01:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 3D1EC24635 for ; Wed, 5 Jul 2017 21:01:00 +0000 (UTC) Date: Wed, 5 Jul 2017 21:01:00 +0000 (UTC) From: "Jens Geyer (JIRA)" To: dev@thrift.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (THRIFT-4237) Go TServerSocket Race Conditions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 05 Jul 2017 21:01:05 -0000 [ https://issues.apache.org/jira/browse/THRIFT-4237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16075423#comment-16075423 ] Jens Geyer commented on THRIFT-4237: ------------------------------------ From what I can see its {{make check}} in the {{/lib/go}} folder. > 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)