You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2017/07/08 13:36:02 UTC

thrift git commit: THRIFT-4237 Fix effective deadlock introduced by original patch Client: Go Patch: Zachary Wasserman

Repository: thrift
Updated Branches:
  refs/heads/master b56ead311 -> 5e9209ff0


THRIFT-4237 Fix effective deadlock introduced by original patch
Client: Go
Patch: Zachary Wasserman <za...@gmail.com>

This closes #1304


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/5e9209ff
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/5e9209ff
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/5e9209ff

Branch: refs/heads/master
Commit: 5e9209ff0f740d9b39450f01dd30fd266d3e80f5
Parents: b56ead3
Author: Zachary Wasserman <za...@gmail.com>
Authored: Thu Jul 6 17:39:55 2017 -0700
Committer: Jens Geyer <je...@apache.org>
Committed: Sat Jul 8 15:35:42 2017 +0200

----------------------------------------------------------------------
 lib/go/thrift/server_socket.go | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/5e9209ff/lib/go/thrift/server_socket.go
----------------------------------------------------------------------
diff --git a/lib/go/thrift/server_socket.go b/lib/go/thrift/server_socket.go
index 68c9a02..80313c4 100644
--- a/lib/go/thrift/server_socket.go
+++ b/lib/go/thrift/server_socket.go
@@ -68,15 +68,19 @@ func (p *TServerSocket) Listen() error {
 
 func (p *TServerSocket) Accept() (TTransport, error) {
 	p.mu.RLock()
-	defer p.mu.RUnlock()
+	interrupted := p.interrupted
+	p.mu.RUnlock()
 
-	if p.interrupted {
+	if interrupted {
 		return nil, errTransportInterrupted
 	}
-	if p.listener == nil {
+
+	listener := p.listener
+	if listener == nil {
 		return nil, NewTTransportException(NOT_OPEN, "No underlying server socket")
 	}
-	conn, err := p.listener.Accept()
+
+	conn, err := listener.Accept()
 	if err != nil {
 		return nil, NewTTransportExceptionFromError(err)
 	}