Skip to content

Fix HTTP/2 write timeout ineffective against TCP-level network blackhole - #9702

Open
fabcipriano wants to merge 2 commits into
lysine-dev:mainfrom
fabcipriano:fix/http2-write-timeout-blackhole-9237
Open

fabcipriano wants to merge 2 commits into
lysine-dev:mainfrom
fabcipriano:fix/http2-write-timeout-blackhole-9237

Conversation

@fabcipriano

Copy link
Copy Markdown

writeTimeout only interrupted flow-control waits via notifyAll(), which cannot unblock a thread parked inside a real socket write/flush. Guard those blocking writes so a timeout cancels the connection socket directly, and thread writeTimeoutMillis through newStream() so the initial HEADERS write is bounded even before the caller configures the new stream's own writeTimeout.

Fixes #9237.

writeTimeout only interrupted flow-control waits via notifyAll(), which
cannot unblock a thread parked inside a real socket write/flush. Guard
those blocking writes so a timeout cancels the connection socket
directly, and thread writeTimeoutMillis through newStream() so the
initial HEADERS write is bounded even before the caller configures the
new stream's own writeTimeout.

Fixes lysine-dev#9237.
} finally {
writeTimeout.exitAndThrowIfTimedOut()
}
guardConnectionWrite { connection.writeData(id, outFinished, sendBuffer, toWrite) }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is turning stream connection flow exhaustion into a socket error, and tearing down the whole connection?

   * Writes are subject to the write window of the stream and the connection. Until there is a
   * window sufficient to send [byteCount], the caller will block. 
...
  @Throws(IOException::class)
  fun writeData(

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Why readTimeout is not useful for http2

2 participants