Skip to content

Conversation

pjannesen
Copy link
Contributor

@pjannesen pjannesen commented Sep 13, 2024

Fixes #107025

@ghost ghost added the area-System.Net.Http label Sep 13, 2024
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Sep 13, 2024
@pjannesen
Copy link
Contributor Author

@dotnet-policy-service agree [company="{your company}"]

@dotnet-policy-service agree [company="Jannesen"]

@pjannesen
Copy link
Contributor Author

@dotnet-policy-service agree company="your company"

@pjannesen the command you issued was incorrect. Please try again.

Examples are:

@dotnet-policy-service agree

and

@dotnet-policy-service agree company="your company"

@dotnet-policy-service agree company="Jannesen"

}
lock ((DisconnectResults as ICollection).SyncRoot)

var disconnectResults = DisconnectResults;
Copy link
Member

Choose a reason for hiding this comment

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

The local variable isn't helpful as it doesn't contain any common expression.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definition of DisconnectResults

private Dictionary<ulong, DisconnectAsyncResult> DisconnectResults =>
    LazyInitializer.EnsureInitialized(ref _disconnectResults, () => new Dictionary<ulong, DisconnectAsyncResult>());

So every access of DisconnectResults is a call to LazyInitializer.EnsureInitialized.
So using the local variable only one call is necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you want to do?

Remove the local variable and directly access DisconnectResults (this will result in more Volatile.Read of _disconnectResults) or do you have another comment.

Copy link
Member

Choose a reason for hiding this comment

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

HttpListener isn't so optimized. I don't think reducing several volatile reads can result in real world difference. Let's focus on fixing only.

Copy link
Contributor

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

@liveans liveans self-assigned this Sep 27, 2024
@liveans
Copy link
Member

liveans commented Sep 27, 2024

Thanks for the contribution! I'll take a look at this PR, asap!

Copy link
Member

@liveans liveans left a comment

Choose a reason for hiding this comment

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

Change LGTM in general, but I also think that if we should consider using ConcurrentDictionary instead of Dictionary and locking it with SyncRoot everywhere. However, that's another PR's concern, IMO.

@liveans liveans merged commit 0d86380 into dotnet:main Oct 2, 2024
85 checks passed
sirntar pushed a commit to sirntar/runtime that referenced this pull request Oct 3, 2024
lambdageek pushed a commit to lambdageek/runtime that referenced this pull request Oct 3, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Nov 2, 2024
@karelz karelz added this to the 10.0.0 milestone Dec 13, 2024
@rokonec
Copy link
Member

rokonec commented Dec 13, 2024

/backport to release/9.0

@github-actions github-actions bot unlocked this conversation Dec 13, 2024
Copy link
Contributor

Started backporting to release/9.0: https://github.com/dotnet/runtime/actions/runs/12317158203

Copy link
Contributor

@rokonec an error occurred while backporting to release/9.0, please check the run log for details!

Error: @rokonec is not a repo collaborator, backporting is not allowed. If you're a collaborator please make sure your dotnet team membership visibility is set to Public on https://github.com/orgs/dotnet/people?query=rokonec

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 13, 2024
@rokonec
Copy link
Member

rokonec commented Dec 13, 2024

/backport to release/9.0

Copy link
Contributor

Started backporting to release/9.0: https://github.com/dotnet/runtime/actions/runs/12317257049

@github-actions github-actions bot unlocked this conversation Dec 13, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 13, 2024
@rokonec
Copy link
Member

rokonec commented Dec 13, 2024

/backport to release/9.0-staging

@github-actions github-actions bot unlocked this conversation Dec 13, 2024
Copy link
Contributor

github-actions bot commented Dec 13, 2024

Started backporting to release/9.0-staging: #110695

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Net community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exception System.InvalidOperationException in HttpListener.EndGetContext
5 participants