-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Unable to provision after upgrading to 1.7 #14574
Comments
Add this to your setup recipe
If you continue to have the issue, please share your error logs. |
Hi @MikeAlhayek ,
As I said before, the DocumentManager.cs throws the following error: "Can't load for update a cached object" Here is the error log:
|
Maybe in your code, you are calling |
Hey @MikeAlhayek , All calls, to the DocumentManager.GetOrCreateMutableAsync method, are coming from OC files. |
In your code, are you not calling Not sure if |
Our provision logic gets the recipe, add some customized information, call the |
@jtkech this code It loads the site settings as immutable, then load it again as mutable if the hash is not defined. OrchardCore/src/OrchardCore/OrchardCore.Infrastructure/Documents/DocumentManager.cs Lines 71 to 76 in 6cf70aa
Then maybe just load the site settings for change in the MediaUpdater, or handle this case without failing in the document manager? @rafaelrph Could you try to replace Another option could be for you to set the |
Hi @sebastienros, Debugging the application with this change:
I didn't understand the HashKey option that you mentioned above. If possible, could you please provide more details? |
Okay, I will look at it this night |
For now I can't repro, before throwing we not only check that the document is already cached but also that it is the same instance, knowing that in the document store when getting an immutable document for caching we also @rafaelrph Hmm, can you check in your code if there is an async task that is not correctly awaited. |
@jtkech so the code in question works on 1.5 but we can double-check if anything is missing. In the meantime here is a screenshot showing where it throws the error along with the document & cached version. |
So I have more information now about this. The exception is happening during the execution of our EnvironmentMigration (which inherits from DataMigration) class. Specifically, it happens when we run a step that tries to add a role after an earlier step has already added roles.
Here is the stack of the origin thread if that helps at all. |
Out of curiosity, shouldn't the RoleStore reset _updating = false at the end of the UpdateRolesAsync() call? What if the instance is used to update something and then used to read a role after without the intent of updating? This is more of a general question since it doesn't seem to be the cause of our problem as I tested out a change that reset _updating = false and it didn't help. |
@jtkech @sebastienros Here is some additional information: I was debugging the EnvironmentMigration class, that Shane mentioned above, going through each recipe. All of our OpenId recipes are failing. All of them have a Roles step, following the same structure that @MikeAlhayek mentioned in one of the very first comments. I checked your sample files for the OpenId recipes (here: https://github.com/OrchardCMS/OrchardCore/tree/0c4e0541b895af5b0afc82e8e4ac01e8dc06333f/test/OrchardCore.Tests/Modules/OrchardCore.OpenId/RecipeFiles) and I didn't see any Roles step there. So I removed the roles step from our own recipes and the OrchardCore.Roles.Models.RolesDocument entry didn't throw the exception anymore. But I'm not sure if that's the right solution for us because we use separate roles. Maybe you guys could clarify that. Here is a sample OpenId recipe file that we are using: Also the following recipes are the ones that throw the exception for the OrchardCore.Settings.SiteSettings entry. |
@ShaneCourtrille @rafaelrph Thanks for the additional info, I''ll try to look at it this weekend.
In that case normally we return the already loaded instance for updating but also a boolean = false meaning that this instance should not be cached so that when the update occurs it will not fail. But managing roles is specific as we have to deal with the dotnet |
@jtkech @sebastienros Here is a new finding. I was debugging our EnvironmentMigration. After I changed the openId recipes removing the roles step (mentioned in my previous comment), and commented out the audit-trail-settings and localization recipes, to not be executed, the DocumentManager still throws the same error I did some investigation and the MediaTokenSettingsUpdater throws the error. It's the same logic that @sebastienros mentioned here: #14574 (comment) I tried to do what @sebastienros suggested and the error started to happen in the line that I changed (the same line wasn't throwing the error before). I also tried to change it in the opposite way, making both logics to call The error OrchardCore/src/OrchardCore.Modules/OrchardCore.Media/Processing/MediaTokenSettingsUpdater.cs Line 47 in ec12082
|
Sorry I didn't have time to look at it, for sure I will work on it this night. |
Okay, so the only ways I could repro.
That said both happen because after the store is well committed this is where we update the shared cache in place of just invalidating it, we did this for perf and because we also have a consistency checking. So both cases could be fixed by just invalidating the shared cache in place of setting it on updating the store. But Can you confirm that you are in one of the above case? Note: Inside a Note: Hmm, maybe good to just invalidate the shared cache on updating the store, currently we also do a db query for consistency checking that would no longer be necessary (simpler code), but a db query will be done on a next demand but only once. About the specific case of But here too this may be a problem only in a |
If you can try what I did here #14612. |
Just to confirm that these changes (#14612) have fixed the cache issue. Thanks for the help. |
Cool, good to know, thanks! |
Describe the bug
To Reproduce
I'm not able to provision a new tenant/client after upgrading to 1.7. (my current version is 1.5)
If fails in the DocumentManager class -> GetOrCreateMutableAsync() when it tries to get/create the OrchardCore.Settings.SiteSettings and OrchardCore.Roles.Models.RolesDocument from the memory cache.
The following exception is thrown:
OrchardCore/src/OrchardCore/OrchardCore.Infrastructure/Documents/DocumentManager.cs
Line 75 in 6cf70aa
Our application uses it in a multi tenant mode without our own layer on top of it.
We also use our own recipes. I saw the following information and I'm not which changes I have to do to make it work.
OrchardCore/src/docs/reference/modules/Recipes/README.md
Line 323 in 8c18439
https://github.com/OrchardCMS/OrchardCore/blob/8c184395c1aa9b40580642a7d0df740ad9cdfac5/src/docs/releases/1.7.0.md#breaking-changes
The text was updated successfully, but these errors were encountered: