PacketWriter may write packet when a previous async write error is not handled completely |
||
Issue description
When handling async write error, if connection migration is turning on, HandleWriteError will be invoked, and a task will be posted to the message loop to complete migration on write error(actually when the task is executed, tasks will be posted to eventually write the packet to socket), HandleWriteError will return ERR_IO_PENDING synchronously. Instead of leaving the writer unblocked, we should block the writer so as to prevent new packets being written before WritePacketToSocket eventually executes. Failed to block the writer may cause write error triggered again or the cached packet goes out of order.
void QuicChromiumPacketWriter::OnWriteComplete(int rv) {
...
write_blocked_ = false;
if (rv < 0) {
if (MaybeRetryAfterWriteError(rv))
return;
// If write error, then call delegate's HandleWriteError, which
// may be able to migrate and rewrite packet on a new socket.
// HandleWriteError returns the outcome of that rewrite attempt.
rv = delegate_->HandleWriteError(rv, std::move(packet_)); <------- MigrateSessionOnWriteError will not be executed when this returns.
DCHECK(packet_ == nullptr);
if (rv == ERR_IO_PENDING)
return; <------------ writer become unblocked, if a write comes in, writer will write another packet again
}
,
Jul 2
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/3c4c9e95d435f760cef0355caf3b23cc59c87a3a commit 3c4c9e95d435f760cef0355caf3b23cc59c87a3a Author: Zhongyi Shi <zhongyi@chromium.org> Date: Mon Jul 02 23:16:23 2018 QUIC Connection Migration V2: always block the packet writer when HandleWriteError retruns ERR_IO_PENDING. Bug: 859259 Change-Id: I24ccedddd21f1a566b56f41bee30395a88a53a45 Reviewed-on: https://chromium-review.googlesource.com/1121592 Reviewed-by: Ryan Hamilton <rch@chromium.org> Commit-Queue: Zhongyi Shi <zhongyi@chromium.org> Cr-Commit-Position: refs/heads/master@{#572035} [modify] https://crrev.com/3c4c9e95d435f760cef0355caf3b23cc59c87a3a/net/quic/chromium/quic_chromium_packet_writer.cc [modify] https://crrev.com/3c4c9e95d435f760cef0355caf3b23cc59c87a3a/net/quic/chromium/quic_stream_factory_test.cc
,
Jul 2
,
Jul 11
Fix in #2 landed in 69.0.3480.0. |
||
►
Sign in to add a comment |
||
Comment 1 by zhongyi@chromium.org
, Jun 30 2018