Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Socket tests: don't retry CanceledByDispose tests on timeout #42725

Closed
wants to merge 4 commits into from

Conversation

tmds
Copy link
Member

@tmds tmds commented Sep 25, 2020

These retries cause masking cases where the operation and
dispose Task are never completing.

Fixes #42686 (comment)

@MihaZupan @antonfirsov ptal

These retries cause masking cases where the operation and
dispose Task are never completing.
@ghost
Copy link

ghost commented Sep 25, 2020

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@antonfirsov antonfirsov left a comment

Choose a reason for hiding this comment

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

Wouldn't it be better to extend RetryHelper to detect fatal failures?

See:
1339f52

@@ -127,7 +127,8 @@ public async Task ConnectGetsCanceledByDispose()
// We try this a couple of times to deal with a timing race: if the Dispose happens
// before the operation is started, we won't see a SocketException.
int msDelay = 100;
await RetryHelper.ExecuteAsync(async () =>
int retries = 10;
while (true)
Copy link
Member

Choose a reason for hiding this comment

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

                catch (SocketException se)
                {
                    // On connection timeout, retry.
                    Assert.NotEqual(SocketError.TimedOut, se.SocketErrorCode);

                    localSocketError = se.SocketErrorCode;
                }

The test fails here on Windows. Should do some more research on SocketError.TimedOut cases, but I think we should keep retrying here.

@antonfirsov
Copy link
Member

Fixes #42686 (comment)

I don't think that a possible test bug is the only concern in #42686.

@tmds
Copy link
Member Author

tmds commented Sep 29, 2020

I don't think that a possible test bug is the only concern in #42686.

Yes, this is only meant to fix the test bug.

@antonfirsov
Copy link
Member

antonfirsov commented Oct 6, 2020

@tmds what do you think about my idea regarding RetryHelper? If we could simplify the changes with that trick, and fix the Windows failure, I'm happy to proceed merging this.

@tmds
Copy link
Member Author

tmds commented Oct 6, 2020

@tmds what do you think about my idea regarding RetryHelper? If we could simplify the changes with that trick, and fix the Windows failure, I'm happy to proceed merging this.

I think you need to look at multiple tests to know whether it makes sense to extend the RetryHelper for this pattern.
I've moved the assert into the try-catch-retry section. It was the simplest way to fix the Windows failure.

@antonfirsov
Copy link
Member

/azp run runtime

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@antonfirsov
Copy link
Member

/azp run runtime

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@antonfirsov
Copy link
Member

/azp run runtime

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@tmds
Copy link
Member Author

tmds commented Oct 15, 2020

Part of #42725.

@tmds tmds closed this Oct 15, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
@karelz karelz added this to the 6.0.0 milestone Jan 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Socket Dispose during synchronous operation hangs on RedHat 7
4 participants