Skip to content

Drain requests in native instead of managed #6816

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

Merged
merged 15 commits into from
Jan 28, 2019
Merged

Conversation

jkotalik
Copy link
Contributor

For #6605 and #6555.

There is a race condition when shutting down and another request coming into the server. Managed perceives that there are no requests remaining, but in native, a request can be instantiated and try to call into managed, which causes app verifier to crash iisexpress/w3wp.

@jkotalik jkotalik requested review from davidfowl and pakrym January 17, 2019 20:27
@jkotalik jkotalik requested a review from Tratcher as a code owner January 17, 2019 20:27
@@ -259,7 +265,7 @@ IN_PROCESS_APPLICATION::ExecuteApplication()
if (m_waitForShutdown)
{
const auto clrWaitResult = WaitForSingleObject(m_clrThread.native_handle(), m_pConfig->QueryShutdownTimeLimitInMS());
THROW_LAST_ERROR_IF(waitResult == WAIT_FAILED);
THROW_LAST_ERROR_IF(clrWaitResult == WAIT_FAILED);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is unrelated, I just noticed that we were checking the wrong wait timeout here.

@pakrym
Copy link
Contributor

pakrym commented Jan 17, 2019

Add a test that opens a hanging connection and requests shutdown, assert that event logs are correct and it doesn't crash.

@Tratcher Tratcher removed their request for review January 17, 2019 23:34
@jkotalik
Copy link
Contributor Author

🆙 📅

@jkotalik jkotalik force-pushed the jkotalik/appOfflineFlaky branch from 39080bb to f52cb2c Compare January 18, 2019 17:21
@pakrym
Copy link
Contributor

pakrym commented Jan 18, 2019

Don't merge until preview 2 ships.

@jkotalik jkotalik added the blocked The work on this issue is blocked due to some dependency label Jan 18, 2019
@jkotalik jkotalik force-pushed the jkotalik/appOfflineFlaky branch from ab1abc1 to bd4196d Compare January 24, 2019 22:43
@jkotalik jkotalik removed the blocked The work on this issue is blocked due to some dependency label Jan 25, 2019
@@ -97,6 +98,11 @@ public Task StopAsync(CancellationToken cancellationToken)
{
_nativeApplication.StopIncomingRequests();

_cancellationTokenRegistration = cancellationToken.Register(() =>
{
_shutdownSignal.TrySetResult(null);
Copy link
Member

Choose a reason for hiding this comment

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

Closure

@jkotalik jkotalik merged commit 7a98a04 into master Jan 28, 2019
@jkotalik jkotalik deleted the jkotalik/appOfflineFlaky branch January 28, 2019 23:20
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants