Copilot commented on code in PR #3531:
URL: https://github.com/apache/brpc/pull/3531#discussion_r3952285370


##########
test/brpc_streaming_rpc_unittest.cpp:
##########
@@ -1394,10 +1394,25 @@ class MyServiceWithStreamCountLimit : public 
test::EchoService {
             std::memory_order_release);
         accepted_streams.store(
             response_streams.size(), std::memory_order_release);

Review Comment:
   `accept_result`/`accepted_streams` are published (release) before 
`_response_streams` is updated under `_mutex`. A thread that observes 
`accepted_streams > 0` (acquire) and then calls `TakeResponseStreams()` can 
still race and drain an empty vector (because the append hasn’t happened yet), 
leaving response streams unclosed until the next drain. To make the 
synchronization scheme consistent, append to `_response_streams` first, then do 
the release stores (or protect the atomics with the same mutex).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to