Please find here a fix for [8336655: java/net/httpclient/DigestEchoClient.java IOException: HTTP/1.1 header parser received no bytes](https://bugs.openjdk.org/browse/JDK-8336655).
This fix has been seen failing intermittently on the mainline. When an HTTP/1.1 is returned to the HTTP/1.1 pool, a CleanupTrigger is registered with the connection. The purpose of the CleanupTrigger is to get the connection socket registered with the selector while the connection is idle in the pool, so that it can be closed and removed from the pool if the peer closes the socket. It will also close and remove the connection from the pool if the peer sends unexpected data. When the connection is taken out of the pool to handle the next exchange, the CleanupTrigger is replaced with the exchange HTTP/1.1 publisher/subscribers. The read suscriber is registered first, to make sure that it is in place before the request headers are sent to the server, so that the response headers are delievered to the exchange subscriber (and not to the CleanupTrigger) when they arrive. However, there's a catch. The subscibers are actually switched in the read scheduler, which means there's an opportunity for the write scheduler to sneak in first. This fix makes sure that reading for the CleanupTrigger is paused first, so that even if the write scheduler loop starts up first, no data will be delivered by the read loop until the exchange subscriber gets subscribed. This should prevent any data to reach the CleanupTrigger after the new exchange has been started. ------------- Commit messages: - 8336655 Changes: https://git.openjdk.org/jdk/pull/20571/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20571&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8336655 Stats: 52 lines in 3 files changed: 41 ins; 0 del; 11 mod Patch: https://git.openjdk.org/jdk/pull/20571.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/20571/head:pull/20571 PR: https://git.openjdk.org/jdk/pull/20571