You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "LI123456mo (via GitHub)" <gi...@apache.org> on 2026/09/10 05:20:04 UTC

[I] [Bug] Make composite input stream handling safe when stream close races with an in-progress read [dubbo]

LI123456mo opened a new issue, #16458:
URL: https://github.com/apache/dubbo/issues/16458

   ### Pre-check
   
   - [x] I am sure that all the content I provide is in English.
   
   
   ### Search before asking
   
   - [x] I had searched in the [issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### Apache Dubbo Component
   
   Java SDK (apache/dubbo)
   
   ### Dubbo Version
   
   Dubbo Java 3.3.7-SNAPSHOT, OpenJDK 25, WINDOWS
   
   ### Steps to reproduce this issue
   
   Fix composite input stream handling so that closing a stream while a concurrent read operation is actively consuming data does not cause unexpected stream closed exceptions or state corruption. When a client connection terminates abruptly during HTTP/2 streaming, the transport layer triggers a stream closure on the I/O event thread, which can execute simultaneously while an application worker thread is reading from the composite input stream for that same request. The composite stream handling must safely synchronize or manage concurrent closure during active reads so that in-flight read operations complete or terminate cleanly without raising unhandled concurrent access errors.
   
   ### What you expected to happen
   
   The composite stream handling must safely synchronize or manage concurrent closure during active reads so that in-flight read operations complete or terminate cleanly without raising unhandled concurrent access errors.
   
   ### Anything else
   
   _No response_
   
   ### Do you have a (mini) reproduction demo?
   
   - [x] Yes, I have a minimal reproduction demo to help resolve this issue more effectively!
   
   ### Are you willing to submit a pull request to fix on your own?
   
   - [x] Yes I am willing to submit a pull request on my own!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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: notifications-unsubscribe@dubbo.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [I] [Bug] Make composite input stream handling safe when stream close races with an in-progress read [dubbo]

Posted by "Lubaoshuai (via GitHub)" <gi...@apache.org>.
Lubaoshuai commented on issue #16458:
URL: https://github.com/apache/dubbo/issues/16458#issuecomment-5654514626

   Hi, is anyone already working on this? Looking at CompositeInputStream, totalAvailable/readIndex are plain ints and the read loop releases the head stream once available() == 0, so a close() racing an in-flight read can observe torn state. I'd like to attempt a fix — my inclination is to make close() idempotent and synchronize the stream swap in the read loop, then define read-after-close as EOF. One question before I start: when close() lands mid-read, should a read() that already copied some bytes return the partial count, or is throwing preferred?


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [I] [Bug] Make composite input stream handling safe when stream close races with an in-progress read [dubbo]

Posted by "LI123456mo (via GitHub)" <gi...@apache.org>.
LI123456mo commented on issue #16458:
URL: https://github.com/apache/dubbo/issues/16458#issuecomment-5700725953

   > Hi, is anyone already working on this? Looking at CompositeInputStream, totalAvailable/readIndex are plain ints and the read loop releases the head stream once available() == 0, so a close() racing an in-flight read can observe torn state. I'd like to attempt a fix — my inclination is to make close() idempotent and synchronize the stream swap in the read loop, then define read-after-close as EOF. One question before I start: when close() lands mid-read, should a read() that already copied some bytes return the partial count, or is throwing preferred?
   
   Hello @Lubaoshuai  , you can work on it you have a good idea, i'll check


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org