[
https://issues.apache.org/jira/browse/THRIFT-5897?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sylwester Lachiewicz closed THRIFT-5897.
----------------------------------------
Fix Version/s: 0.24.0
Resolution: Fixed
TServerSocket.Accept takes a read lock: lib/go/thrift/server_socket.go reads
p.interrupted and p.listener under p.mu.RLock(). That came in with commit
ff01b9e58 (PR #3379), released in 0.24.0.
Closing as fixed.
> Use read lock for listener access in TServerSocket.Accept()
> -----------------------------------------------------------
>
> Key: THRIFT-5897
> URL: https://issues.apache.org/jira/browse/THRIFT-5897
> Project: Thrift
> Issue Type: Bug
> Components: Go - Library
> Reporter: Atharva Chiplunkar
> Assignee: Atharva Chiplunkar
> Priority: Major
> Fix For: 0.24.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Currently, TServerSocket.Accept() uses two separate lock acquisitions:
> 1. RLock for reading 'interrupted' field
> 2. write lock for reading 'listener' field
> Since both fields are only being read (not modified), both can be protected
> by a single read lock (RLock). This optimization:
> - Reduces lock contention by eliminating unnecessary write lock
> - Allows multiple Accept() calls to proceed concurrently
> Change:
> - Combine both field reads under a single RLock/RUnlock pair
> - Remove unnecessary write lock (Lock/Unlock)
> This is a performance optimization with no functional change.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)