EarthChen commented on code in PR #16583:
URL: https://github.com/apache/dubbo/pull/16583#discussion_r4595791401


##########
dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/command/HttpWriteQueue.java:
##########
@@ -42,6 +49,10 @@ protected void prepare(HttpChannelQueueCommand item) {
     @Override
     protected void flush(HttpChannelQueueCommand item) {
         item.run();
-        item.getHttpChannel().flush();
+        if (batchFlush != null) {
+            batchFlush.run();

Review Comment:
   The comment in `HttpWriteQueueHandler` explains the wiring well, but this 
branch is the fragile point: a future reader seeing only this file could 
simplify it back to `item.getHttpChannel().flush()`, which is exactly the 
closed-stream bug this PR fixes. A brief note here would pin the invariant:
   
   ```suggestion
           // A batch boundary must flush the channel that owns this queue, not 
the last
           // command's channel: for HTTP/2 that channel can be a closed 
stream, and flushing
           // it leaves earlier sibling writes buffered on the connection. Same 
pattern as
           // grpc-java's WriteQueue and the deprecated tri WriteQueue 
(ch.parent().flush()).
           batchFlush.run();
   ```
   
   Feel free to reword; non-blocking.



-- 
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