ok2c commented on PR #709: URL: https://github.com/apache/httpcomponents-client/pull/709#issuecomment-3219881134
@rschmitt I believe I have found the underlying cause of the problem (or misunderstanding if you agree to see it that way) Here is the thing. The HTTP/1.1 by default aggressively pipeline request messages. What that basically means the client can write out n requests before the server gets to process the first once and drop the connection. ``` exchange 1: POST /ping exchange 1: stale-check (success) exchange 2: POST /ping exchange 2: stale-check (success) exchange 3: POST /ping exchange 3: stale-check (success) exchange 1: 200 OK exchange 1: server closes connection exchange 2: boom exchange 3: boom ``` The stale connection check cannot help when pipelining is being employed because the connection is perfectly valid at the time of request initiation. The H2 tests do not exhibit this problem because the server limits the number of concurrent streams to 1 ``` out.write(ff.createSettings( ... new H2Setting(H2Param.MAX_CONCURRENT_STREAMS, 1), ... ), outputStream); ``` I do not know if this is intentional or not but with the message pipelining not used, I get 100% reliability of message exchanges with both HTTP/1.1 and H2 using code with slight modifications to ensure HTTP/1.1 get executed sequentially ``` h2: Validation disabled: Sequential requests (slow): 10 succeeded; 0 failed (100.00% success rate) h2: Validation enabled: Sequential requests (slow): 10 succeeded; 0 failed (100.00% success rate) h2: Validation disabled: Sequential requests (rapid): 199 succeeded; 1 failed (99.50% success rate, 0.50% retriable) h2: Validation enabled: Sequential requests (rapid): 200 succeeded; 0 failed (100.00% success rate) h2: Validation disabled: Single large batch: 30 succeeded; 0 failed (100.00% success rate) h2: Validation enabled: Single large batch: 30 succeeded; 0 failed (100.00% success rate) h2: Validation disabled: Multiple small batches: 15 succeeded; 0 failed (100.00% success rate) h2: Validation enabled: Multiple small batches: 15 succeeded; 0 failed (100.00% success rate) h2c: Validation disabled: Sequential requests (slow): 10 succeeded; 0 failed (100.00% success rate) h2c: Validation enabled: Sequential requests (slow): 10 succeeded; 0 failed (100.00% success rate) h2c: Validation disabled: Sequential requests (rapid): 200 succeeded; 0 failed (100.00% success rate) h2c: Validation enabled: Sequential requests (rapid): 200 succeeded; 0 failed (100.00% success rate) h2c: Validation disabled: Single large batch: 30 succeeded; 0 failed (100.00% success rate) h2c: Validation enabled: Single large batch: 30 succeeded; 0 failed (100.00% success rate) h2c: Validation disabled: Multiple small batches: 15 succeeded; 0 failed (100.00% success rate) h2c: Validation enabled: Multiple small batches: 15 succeeded; 0 failed (100.00% success rate) https: Validation disabled: Sequential requests (slow): 10 succeeded; 0 failed (100.00% success rate) https: Validation enabled: Sequential requests (slow): 10 succeeded; 0 failed (100.00% success rate) https: Validation disabled: Sequential requests (rapid): 182 succeeded; 18 failed (91.00% success rate, 9.00% retriable) https: Validation enabled: Sequential requests (rapid): 200 succeeded; 0 failed (100.00% success rate) https: Validation disabled: Single large batch: 29 succeeded; 1 failed (96.67% success rate, 3.33% retriable) https: Validation enabled: Single large batch: 30 succeeded; 0 failed (100.00% success rate) https: Validation disabled: Multiple small batches: 15 succeeded; 0 failed (100.00% success rate) https: Validation enabled: Multiple small batches: 15 succeeded; 0 failed (100.00% success rate) http: Validation disabled: Sequential requests (slow): 10 succeeded; 0 failed (100.00% success rate) http: Validation enabled: Sequential requests (slow): 10 succeeded; 0 failed (100.00% success rate) http: Validation disabled: Sequential requests (rapid): 191 succeeded; 9 failed (95.50% success rate, 4.00% retriable) http: Validation enabled: Sequential requests (rapid): 200 succeeded; 0 failed (100.00% success rate) http: Validation disabled: Single large batch: 29 succeeded; 1 failed (96.67% success rate, 0.00% retriable) http: Validation enabled: Single large batch: 30 succeeded; 0 failed (100.00% success rate) http: Validation disabled: Multiple small batches: 15 succeeded; 0 failed (100.00% success rate) http: Validation enabled: Multiple small batches: 15 succeeded; 0 failed (100.00% success rate) ``` -- 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: dev-unsubscr...@hc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org