Issue #1958 Blocking timeout spurious wakeups (#1975)

* Issue #1958 Blocking timeout

Use tryFillInterested to allow retries on spurious wakeups

Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
Greg Wilkins 2017-11-15 18:13:00 +01:00 committed by GitHub
parent 0f07c6518e
commit 918cf625cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -564,7 +564,15 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
public void blockingReadFillInterested()
{
getEndPoint().fillInterested(_blockingReadCallback);
// We try fillInterested here because of SSL and
// spurious wakeups. With blocking reads, we read in a loop
// that tries to read/parse content and blocks waiting if there is
// none available. The loop can be woken up by incoming encrypted
// bytes, which due to SSL might not produce any decrypted bytes.
// Thus the loop needs to register fill interest again. However if
// the loop is woken up spuriously, then the register interest again
// can result in a pending read exception, unless we use tryFillInterested.
getEndPoint().tryFillInterested(_blockingReadCallback);
}
public void blockingReadFailure(Throwable e)