You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/03/23 21:00:27 UTC
[jira] [Commented] (THRIFT-3753) TServerFramework::stop may fail to
interrupt connected clients
[ https://issues.apache.org/jira/browse/THRIFT-3753?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15209049#comment-15209049 ]
ASF GitHub Bot commented on THRIFT-3753:
----------------------------------------
GitHub user tpcwang opened a pull request:
https://github.com/apache/thrift/pull/959
THRIFT-3753 Fixed a race condition in TServerFramework::stop that prevents clean server shutdown
This is a sequence that exposes the race condition:
(1) Thread-1: in serve(), blocked on accept()
(2) Thread-2: in stop(), calls interrupt()
(3) Thread-2: in stop(), in interruptChildren(), checked that socket is valid
(4) Thread-1: in serve(), unblocked because of interrupt(), calls releaseOneDescriptor
(5) Thread-2: in interruptChildren(), send fails so clients are not interrupted
Closing a socket while it is being polled/selected may or may not work on all platforms, so I think changing the order is better.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/tpcwang/thrift THRIFT-3753
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/thrift/pull/959.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #959
----
commit 712df0e1473b56909e8f4a393fe64607f4493a47
Author: tpcwang <tp...@gmail.com>
Date: 2016-03-23T19:20:44Z
Fixed a race condition in TServerFramework::stop that prevents clean server shutdown.
This is a sequence that exposes the race condition:
(1) Thread-1: in serve(), blocked on accept()
(2) Thread-2: in stop(), calls interrupt()
(3) Thread-2: in stop(), in interruptChildren(), checked that socket is valid
(4) Thread-1: in serve(), unblocked because of interrupt(), calls releaseOneDescriptor
(5) Thread-2: in interruptChildren(), send fails so clients are not interrupted
----
> TServerFramework::stop may fail to interrupt connected clients
> --------------------------------------------------------------
>
> Key: THRIFT-3753
> URL: https://issues.apache.org/jira/browse/THRIFT-3753
> Project: Thrift
> Issue Type: Bug
> Components: C++ - Library
> Affects Versions: 0.9.3
> Reporter: Ted Wang
>
> This is a sequence that exposes the race condition:
> (1) Thread-1: in serve(), blocked on accept()
> (2) Thread-2: in stop(), calls interrupt()
> (3) Thread-2: in stop(), in interruptChildren(), checked that socket is valid
> (4) Thread-1: in serve(), unblocked because of interrupt(), calls releaseOneDescriptor
> (5) Thread-2: in interruptChildren(), send fails so clients are not interrupted
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)