-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Support attaching to an existing request queue in HTTP.SYS #14182
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
Support attaching to an existing request queue in HTTP.SYS #14182
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, getting this rebased does help.
There are some open issues from #5866 that we hadn't figured out how to address yet. Most of these are centered around ensuring each listener on a queue is using the same configuration. For things like timeouts it's at most a warning that the config is out of sync, but for auth and PathBase it can affect how requests are processed.
- PathBase will need a fallback mode when attached to existing queues where it can't look things up by index.
- For auth we might want to query the queue settings to see if they match and fail otherwise
- I'm not sure if we can query for the timeout settings.
- Some options can be changed after the server starts such as UrlPrefixes. We need to make sure those code paths are disabled (and throw?) if this instance did not create the queue.
- Do we need to surface an API that says if this instance did attach or create?
I'll pull your branch and see what I can work on in your off hours. Want to give me push access to your fork?
src/Servers/HttpSys/ref/Microsoft.AspNetCore.Server.HttpSys.netcoreapp.cs
Outdated
Show resolved
Hide resolved
FYI @Tratcher check in with me before merging. As this is feature work we'll require special approval for 3.1 (shouldn't be a problem). |
Didn't make any progress on this today other than squashing and relocating my old branch to make it easier to reference: 2c48243 |
Made some progress, I pulled in the missing parts from the prior branch including tests and some misc fixes. I'll start on the actual review tomorrow. |
27a8b65
to
bf83d2c
Compare
I think that's everything for now.
|
paging @davidfowl @rynowak for API review (not sure who else wants to be involved or if a GitHub team has been set up yet). |
The changes look fine to me. Thank you. |
Note relative to "Created" - my understanding is that HTTP.SYS will automatically delete a queue if there are no active references to it by any process. In our case we will have a management process create and configure the queues and pass then name into our ASP.NET Core process - this is similar to how IIS works when it starts W3WP.exe. We will either directly spawn (security context inheritance) or set the ACLs appropriately - TBD. In any case we plan on handling that part. Let me know when you have a drop for me to begin testing on. Cheers! |
@@ -32,6 +32,9 @@ internal AuthenticationManager() | |||
{ | |||
} | |||
|
|||
/// <summary> | |||
/// When attaching to an existing queue this setting must match the one used to create the queue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be a remark rather than summary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remarks aren't visible in most situations.
out requestQueueHandle); | ||
} | ||
|
||
if (flags == HttpApiTypes.HTTP_CREATE_REQUEST_QUEUE_FLAG.OpenExisting && statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_FILE_NOT_FOUND) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this technically check CreateOrAttach and OpenExisting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's why I'm checking the flags and not the RequestQueueMode enum.
Edit: Nevermind, I answered the wrong question. No, you want this detailed error for both Attach and CreateOrAttach. You tried to attach to a thing by name and it wasn't there. For CreateOrAttach that should only happen with a strange race condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For CreateOrAttach that should only happen with a strange race condition.
Yeah, the strange race condition is what I was referring to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's really worth guarding against that race condition, since to do so would require some sort of looping.
src/Servers/HttpSys/test/FunctionalTests/Listener/ServerOnExistingQueueTests.cs
Show resolved
Hide resolved
# Conflicts: # src/Servers/HttpSys/ref/Microsoft.AspNetCore.Server.HttpSys.netcoreapp.cs
8c8e0ad
to
9dc1ec6
Compare
@davidfowl this needs to be merged Very Soon. What if anything do you want to do for API review here? |
What’s the failure mode here? |
The managed layer enforces AllowAnonymous and adds challenges based on what's configured. Worst case you end up requiring more auth than the underlying queue supports and the client gets rejected with 401s. |
I am good here.
|
@anurse this is ready to merge. |
Support attaching to an existing request queue in HTTP.SYS ( #5866). This is an addendum to
“https://github.com/aspnet/AspNetCore/issues/13461”.
This is criticial (P0) functionality required by Office 365 in support of our new ASP.Net Core 3.X architecture for data access to Substrate Storage. This is the storage that is mission critical for Office 365.