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
Cleaning up MainDom and other resources preventing clean shutdown/startup #6757
Conversation
…unner was not using HostingEnvironment.Stop correctly, ensures no exception is thrown when setting task result on a background task, ensure multiple terminations don't occur, ensure terminations are done if shutdown fails.
… when it acquires maindom
788003b
to
44ed611
Compare
I agree with your changes above that I understand. Especially |
Hey @John-Blair If you type in You may then have "upstream" set to the real version here, you can then do If no upstream is set you can run
Hope this helps 🙂 |
Thanks for the help. I made the original mistake of rebasing to the "v8/bugfix/6546-MainDom-Cleanup" branch on my original fork - thinking that was switching to the branch...that's git noob status for you! |
…'s not MainDom, adds logging
… are run even if one throw on shutdown.
…aled, remove the GCHandle
… clean up the local DB.
… in a finally. Also dispose could throw an error so catch it and complete the clean up.
…ny latched tasks are canceled even with Stop(immediate == false) is executed.
…block the shutdown of other IRegisteredObjects
…terminate to ensure that all cancelation tokens are canceled and cleared
# Conflicts: # src/Umbraco.Core/MainDom.cs # src/Umbraco.Web/PublishedCache/NuCache/ContentStore.cs # src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs
…xception where necessary, adds logging to tests, fixes a boolean op
Based on some discussion here #6546
The gist is that we can be more robust in handling MainDom and shutdown logic with background task runners. We are currently preventing the app from shutting down in a fast manner which this will help resolve. We are not properly releasing resources.
Changes
AsyncLock
toSystemLock
Event
andWaitCompletionPacket
and when investigating on the server we get more details that the event isEvent Type Manual Reset
&Event is Set
... there is a possibility that these handles are these EventWaitHandles (since we have yet to find the cause)Stop(false)
was called, which is incorrect. It means that neither of these things would ever be listening forStop(true)
even though there is code to deal with theimmediate == true
value which would never be hit. In some cases, depending on how an app is shutdown, this may have led to some inconsistencies when winding down the app.immediate==false
but it will always call withimmediate==true
SetResult(0)
was being called on an already completed task causing an exception to occur. Since this was happening during shutdown, this could have had other consequences causing the app to not unwind correctly.Shutdown
failed for any reason, the background runner would not terminate properly, this could have had other consequences causing the app to not unwind correctly.