Skip to content

Socket Dispose during synchronous operation hangs on RedHat 7 #42686

Description

@MihaZupan

Disposing a Socket that has a pending synchronous Connect/Accept operation intermittently hangs on RedHat7 and CentOS7 x64 in CI.

using var client = new Socket(SocketType.Stream, ProtocolType.Tcp);

Exception ex = await Assert.ThrowsAnyAsync<Exception>(async () =>
{
    Task connectTask = Task.Run(() => client.Connect(endPoint));
    await WaitForEventAsync(events, "ConnectStart"); // Wait until the operation starts
    Task disposeTask = Task.Run(() => client.Dispose());
    await new[] { connectTask, disposeTask }.WhenAllOrAnyFailed(); // Hang
});

Existing Connect and Accept tests are potentially masking this failure with the use of a timeout/retry combo.

Example CI Console log

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions