Github user econner commented on a diff in the pull request:
https://github.com/apache/thrift/pull/1304#discussion_r126207049
--- Diff: lib/go/thrift/server_socket.go ---
@@ -68,15 +68,18 @@ func (p *TServerSocket) Listen() error {
func (p *TServerSocket) Accept() (TTransport, error) {
p.mu.RLock()
- defer p.mu.RUnlock()
+ listener := p.listener
+ interrupted := p.interrupted
+ p.mu.RUnlock()
--- End diff --
Hmm. It seems safest to me to unlock this mutex after the value of
``interrupted`` has been read (assuming it is only intended to protect
``interrupted``).
For example,
Thread 1 reads the value of interrupted as false
Thread 1 gets interrupted at line 74
Thread 2 sets p.interrupted to true
Thread 1 sees interrupted == false at line 75
The question is would we want thread 1 to see interrupted == true ?
This is possibly a case that does not happen. I have very limited
knowledge of what this code is doing.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---