[ 
https://issues.apache.org/jira/browse/THRIFT-5896?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jens Geyer resolved THRIFT-5896.
--------------------------------
    Fix Version/s: 0.23.0
         Assignee: Atharva Chiplunkar
       Resolution: Fixed

> 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
>            Assignee: Atharva Chiplunkar
>            Priority: Major
>              Labels: easyfix, patch
>             Fix For: 0.23.0
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> 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)

Reply via email to