This is an automated email from the ASF dual-hosted git repository.

zrlw pushed a commit to branch 3.3
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.3 by this push:
     new 1cb1409181 Fix init stream race (#16039)
1cb1409181 is described below

commit 1cb1409181c6098eda1d0c2c37251843d91804cc
Author: earthchen <[email protected]>
AuthorDate: Fri Jan 23 14:33:31 2026 +0800

    Fix init stream race (#16039)
    
    * refactor: enhance backpressure handling with byte tracking in HTTP/2 
streams
    
    * Update 
dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/h2/Http2ServerChannelObserver.java
    
    Co-authored-by: Copilot <[email protected]>
    
    * Update 
dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/h2/Http2ServerChannelObserver.java
    
    Co-authored-by: Copilot <[email protected]>
    
    * fix
    
    * refactor: expose methods for byte tracking in AbstractTripleClientStream 
and Http2ServerChannelObserver
    
    * refactor: enhance error handling and byte tracking in HTTP/2 stream 
observers
    
    * refactor: improve closing logic and state management in 
LengthFieldStreamingDecoder
    
    * fix: prevent race condition in stream initialization
    
    ---------
    
    Co-authored-by: Copilot <[email protected]>
---
 .../org/apache/dubbo/rpc/protocol/tri/call/TripleClientCall.java    | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/call/TripleClientCall.java
 
b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/call/TripleClientCall.java
index b76d9a00c9..128b649c6c 100644
--- 
a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/call/TripleClientCall.java
+++ 
b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/call/TripleClientCall.java
@@ -307,8 +307,12 @@ public class TripleClientCall implements ClientCall, 
ClientStream.Listener {
         for (ClientStreamFactory factory : 
frameworkModel.getActivateExtensions(ClientStreamFactory.class)) {
             stream = factory.createClientStream(connectionClient, 
frameworkModel, executor, this, writeQueue);
             if (stream != null) {
-                stream.initStream();
+                // Set this.stream BEFORE initStream() to avoid race condition:
+                // initStream() triggers onReady callback asynchronously, 
which may execute
+                // in another thread before this.stream is set if we set it 
after initStream().
+                // This would cause isReady() to return false because it 
checks stream == null.
                 this.stream = stream;
+                stream.initStream();
                 return;
             }
         }

Reply via email to