Problem with enabling features in 1.7.1

Topics: Administration, General, Troubleshooting
Nov 1, 2013 at 2:48 PM

During installation I use IModuleService from Orchard.Modules (custom command) to enable a set of features (~10 main and ~35 dependent modules).

On 1.6 it takes only few minutes, and everything works fine, but after migration to 1.7.1 I observed that enabling custom features after installation takes much more time and resources than earlier (at least 15-20 minutes and use 100% of CPU core).

When I looked into database (SqlCE), I saw that many of those modules are in "Rising" state for almost all this time. There are no errors in log files.

Do you have any ideas how can I fix this problem? Maybe what kind of operations are performed when "feature enable" is called that may takes so much time? With previous version of Orchard everything works smoothly.

Thanks in advance for any ideas,
Nov 1, 2013 at 4:47 PM
Would like to know if you can create a set of repro steps with one module. That would help to find the issue.

Also, why aren't you using the Recipes to enable modules ?
Nov 1, 2013 at 8:49 PM
Even single module (with some dependencies) it takes more then 5 minutes to complete.
Module without dependencies start normally.

I've noticed also some strange (for me) situation when I tried to enable my standard list of modules (mentioned ~10 main + dependencies):
In EnableFeatures method of FeatureManager, UpdateShellDescriptor() method was called with a list enabledFeatures of almost 2000 items, where less than 100 were distinct, the rest were duplicated entries:
_shellDescriptorManager.UpdateShellDescriptor(shellDescriptor.SerialNumber, enabledFeatures, shellDescriptor.Parameters);
I checked Dependencies entries in Module.txt files, but they looks fine. EnableFeatures method of IModuleService was called with only 10 main module ids.

I'm using Recipes, but list of features, that should be enabled depends on some additional factors, so instead of using "Feature" section of recipe, there is a call of custom command at the end of "Command" section. Already tried to put those modules into "Feature" but it didn't solve the problem.
Nov 5, 2013 at 1:12 PM
Sorry for double post, but I found more details:

When I installed Orchard with only one custom module (with 11 dependencies) in ShellStateCoordinator.cs there is a loop that install all modules in "Rising" state:
foreach (var entry in allEntries.Where(entry => IsRising(entry.FeatureState))) {
                if (entry.FeatureState.InstallState == ShellFeatureState.State.Rising) {
                    Logger.Information("Installing feature '{0}'", entry.Feature.Descriptor.Id);
                    _stateManager.UpdateInstalledState(entry.FeatureState, ShellFeatureState.State.Up);
                if (entry.FeatureState.EnableState == ShellFeatureState.State.Rising) {
                    Logger.Information("Enabling feature '{0}'", entry.Feature.Descriptor.Id);
                    _stateManager.UpdateEnabledState(entry.FeatureState, ShellFeatureState.State.Up);
public void Installing(Feature feature) {
            var featureName = feature.Descriptor.Id;
It calls Update method from DataMigrationManager, which is recursively called for every dependent module, so many of them, like My.Commons or Orchard.Users are called multiple times:
public void Update(string feature){
            Logger.Information("Updating feature: {0}", feature);

            // proceed with dependent features first, whatever the module it's in
            var dependencies = _extensionManager.AvailableFeatures()
                .Where(f => String.Equals(f.Id, feature, StringComparison.OrdinalIgnoreCase))
                .Where(f => f.Dependencies != null)
                .SelectMany( f => f.Dependencies )

            foreach(var dependency in dependencies) {

            var migrations = GetDataMigrations(feature);
Not sure, if this is Orchard problem or intentional behavior, but example installation with only one module enabled takes ~ 5 minutes.
Quick test shows, that during this process, Update function for "My.Commons" module was called about 500 times, for "Orchard.Users" even more.

Above functionality takes most of processing time.
Marked as answer by plor on 11/6/2013 at 1:21 PM