Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Conversation

@geoffkizer
Copy link

This change moves the connection initiation outside of the pool lock.

Also, refactor slightly so that there is a single path for new connection creation, whether this happens because we are below the connection limit, or when the waiter completes with an available connection count but no actual connection.

@stephentoub

@geoffkizer
Copy link
Author

@dotnet-bot test outerloop linux x64 debug build
@dotnet-bot test outerloop Windows x64 debug build
@dotnet-bot test outerloop OSX x64 debug build

}
catch
{
DecrementConnectionCount();
Copy link
Member

Choose a reason for hiding this comment

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

I noticed this in the preexisting code as well, but I'm wondering if there's anything that could trigger DecrementConnectionCount itself to throw, in which case the above DCC() call could end up throwing, entering this catch block, and calling DCC() again. Maybe we should refactor this try/catch to only have the CreateHttp11ConnectionAsync call in the try/catch?

Copy link
Author

Choose a reason for hiding this comment

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

DecrementConnectionCount shouldn't throw. That said, I agree that it's better to restructure the code as you suggest. I'll revisit this.

private ValueTask<HttpConnection> GetOrReserveHttp11ConnectionAsync(CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested)
{
Copy link
Member

Choose a reason for hiding this comment

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

You removed the tracing on purpose? That's fine, just verifying.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, on purpose. One thing I've noticed in using tracing recently is that it's too verbose about trivial things, e.g. objects getting created. This trace seemed rather trivial, so I removed it.

That said, looking at this particular instance, this is not really an example of unnecessary verbosity; I may have been too eager here.

@stephentoub
Copy link
Member

@dotnet-bot test this please

…, and refactor some connection creation logic
@stephentoub
Copy link
Member

@dotnet-bot test NETFX x86 Release Build
Build please
@dotnet-bot test Windows x64 Debug Build
Build please

@stephentoub
Copy link
Member

@dotnet-bot test Outerloop Windows x64 Debug Build please

1 similar comment
@stephentoub
Copy link
Member

@dotnet-bot test Outerloop Windows x64 Debug Build please

@stephentoub stephentoub merged commit 83e8985 into dotnet:master Oct 20, 2018
@karelz karelz added this to the 3.0 milestone Nov 15, 2018
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants