Atharva Chiplunkar created THRIFT-5896:
------------------------------------------
Summary: Race condition in TServerSocket.Addr() method
Key: THRIFT-5896
URL: https://issues.apache.org/jira/browse/THRIFT-5896
Project: Thrift
Issue Type: Bug
Components: Go - Library
Reporter: Atharva Chiplunkar
The `Addr()` method in `lib/go/thrift/server_socket.go` accesses the
`p.listener` field without mutex protection, which can cause data races when
multiple goroutines access it concurrently.
## Race Condition Scenario
A data race occurs when:
- One goroutine calls `Addr()` and reads `p.listener`
- Another goroutine calls `Close()`, `Open()`, or `Listen()` and modifies
`p.listener`
## Proposed Fix
Add proper mutex protection consistent with other methods in the struct:
- Use `RLock()`/`RUnlock()` for thread-safe read access
- Use `IsListening()` helper method for consistency
## Impact
Low-Medium: The race condition could cause crashes or incorrect behavior in
concurrent scenarios, but may not be frequently triggered in typical usage.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)