You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by GitBox <gi...@apache.org> on 2019/02/19 20:57:41 UTC

[GitHub] rhernandez35 opened a new pull request #110: HTTPCORE-568: Signal capacity in ReactiveDataConsumer whenever possible

rhernandez35 opened a new pull request #110: HTTPCORE-568: Signal capacity in ReactiveDataConsumer whenever possible
URL: https://github.com/apache/httpcomponents-core/pull/110
 
 
   This fixes a race condition in ReactiveDataConsumer that would cause the
   input window to never be updated over HTTP/1.x connections. The bug
   occurs when consume is the first method to call flushToSubscriber,
   enough data has been received to exhaust the initial input window in the
   stream duplexer, and there are still downstream requests for data that
   haven't been served.
   
   ReactiveDataConsumer attempts to flush data downstream whenever it gets
   a chance, and only one thread is allowed to flush. After flushing, it
   signals the number of bytes flushed to its capacity channel.
   
   If the flush occurs because AbstractHttp1StreamDuplexer is calling
   consume, it guarantees the capacity channel won't be set until consume
   (and the flush) returns.  When there are still outstanding requests
   (meaning the subscriber is unlikely to call request again), the flush
   from consume will be the last attempt to signal capacity. The channel
   isn't set yet, so nothing happens. As a result,
   AbstractHttp1StreamDuplexer's input window remains empty,
   ReactiveDataConsumer receives no further interactions, and the response
   stops being read.
   
   We can fix this by signaling capacity from both flushToSubscriber and
   updateCapacity.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org