Skip to content

QuicConnection.OpenOutboundStreamAsync can hang indefinitely #101233

Closed
@rzikm

Description

@rzikm

When starting a QuicStream, we call MsQuicStreamStart

internal ValueTask StartAsync(CancellationToken cancellationToken = default)
{
_startedTcs.TryInitialize(out ValueTask valueTask, this, cancellationToken);
{
unsafe
{
int status = MsQuicApi.Api.StreamStart(
_handle,
QUIC_STREAM_START_FLAGS.SHUTDOWN_ON_FAIL | QUIC_STREAM_START_FLAGS.INDICATE_PEER_ACCEPT);
if (ThrowHelper.TryGetStreamExceptionForMsQuicStatus(status, out Exception? exception))
{
_startedTcs.TrySetException(exception);
}
}
}
return valueTask;
}

TryGetStreamExceptionForMsQuicStatus attempts to classify the status code and behaves accordingly.

internal static bool TryGetStreamExceptionForMsQuicStatus(int status, [NotNullWhen(true)] out Exception? exception)
{
if (status == QUIC_STATUS_ABORTED)
{
// If status == QUIC_STATUS_ABORTED, we will receive an event later, which will complete the task source.
exception = null;
return false;
}

However, MsQuicStreamStart can return QUIC_STATUS_ABORTED, and in this case we will not receive any event because the stream is not considered started.

This may be the cause of some of the "The operation has timed out" CI failures.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions